Tagged Questions

A variable is a storage location and an associated symbolic name (an identifier) which contains some known or unknown quantity or information, a value. The variable name is the usual way to reference the stored value; this separation of name and content allows the name to be used independently of ...

learn more… | top users | synonyms

1
vote
0answers
140 views

Track usernames with piwik

I'm wondering if there is a way to send current logged username to Piwik and display it beside the ip address in the stats. I need to see which users viewed a specific page and which users downloaded ...
0
votes
1answer
520 views

Rewrite Rules problem when rule includes homepage slug

I have page Example (ID=443, slug=example) that is configured, through Dashboard->Settings->Reading, as the home page of my WP site. I also have the following rewrite rule configured: ...
2
votes
3answers
1k views

How to make variables in URL look like the permalink structure?

I've been looking for the answer to this everywhere but with no success and that's why I'm asking here. I don't even know if the question is the right one. In any case, I'll try to explain. I have ...
6
votes
3answers
4k views

How to Pass External Variables to Filters/Actions

I find myself needing to pass custom data to a filter provided by a 3rd party plugin. All of the ways I've seen to do this are really complicated and hard to wrap my head around. Take this example: ...
0
votes
1answer
79 views

How to get CGI variables?

I need to do two things: Add a CGI variable (say filter=21) to the current query and make a link to this modified URL. Fetch the value of CGI variable "filter". How to do that in WordPress?
0
votes
1answer
224 views

Not passing correct value to get_post_ancestors?

I've got a custom plugin that creates a menu in the sidebar. I need to be able to specify that, if a particular custom post type is current, the menu displays as if it were on a specific page (so ...
0
votes
2answers
193 views

How to use variables from widgets in other pages?

I have a widget where I set some custom url's like register or login. I want to use those variables declared in a widget outside of the widget, in other pages (page templates). How can I save or use, ...
2
votes
1answer
1k views

How to var_dump nav menu items from anywhere?

I wanna preview all the fields that the nav menu $item array holds. Is there a function to fetch it from anywhere and place it inside var_dump?
4
votes
4answers
2k views

Where to get information about array fields in $_REQUEST?

I just started to learn PHP and doing things with WordPress and I am a bit confused about information in Codex. Was told that Codex got all info I required but I got stuck with it. What array fields ...
0
votes
2answers
334 views

persist a variable set in header.php all the way down to footer.php

I look up a custom post field value in header.php, and store it in a global variable. In most of my template files, the includes go like this: include header ...do a bunch of stuff include ...
1
vote
1answer
162 views

Echoing a variable inside a function

In the interest of automation, instead of making a long list of code like this <td valign="top"width="50%"><p><label for="Facebook"><strong>Facebook ...
0
votes
2answers
529 views

Wordpress loop: Display <div> if posts exist

In a single post template I am trying to output some header text in a <div> and display links to related posts in a <ul> if related posts exist (based on tags). If there are no posts, ...
2
votes
2answers
7k views

Using $_GET variables in the URL?

I need to generate a simple error message on a page by passing a variable through the URL. The URL is structured as follows: http://site.com/parent-category/category/?error=pause I'm sure it's the ...
0
votes
1answer
42 views

Help me edit a variable with php

I'm using the plugin Multiple Content Blocks, which creates separate windows for content so that you can have, say, a 2-column template for a page; one column is editable in the standard TinyMCE ...
0
votes
1answer
718 views

Loop info in jquery Tabs - loop into a variable?

I've got three loops set up via jQuery UI tabs as seen in my code below. All works good but i'd like to be able to display the "count" of each loop in the tab label. I obviously can't just echo it ...
0
votes
1answer
710 views

Can't Access Sessions or Variables through pages

So I'm trying to use a session to move a variable through pages. For some reason I literally cannot access anything from index.php to archive. I declare my session at the very top of my header.php ...
0
votes
1answer
221 views

My class function is not seeing GET url paramaters

I have a set of variable set up, created with add_filter in my plugin functions file: add_filter('query_vars', 'user_country_var' ); add_filter('query_vars', 'user_lat_var' ); ...
4
votes
1answer
682 views

Variables declared in header not available in other includes

I have a var set in my header.php file: $myBool = false; and in page.php, I try to echo it: echo $myBool; But the variable is never set. This doesn't help either: global $myBool; echo $myBool; ...
0
votes
1answer
496 views

PHP variables in a post?

I'm very new to PHP. On a Wordpress site, I want to use custom Google Maps with the Javascript API V3. Some posts will have maps in them, and I want to use PHP variables to determine the unique ...
1
vote
2answers
749 views

How to declare a JS variable in an AJAX call

I'm using: wp_localize_script( $handle, $namespace, $variables ); to declare some variables before the initial AJAX call is made, but I imagine I can't do the same thing again within a callback ...
-1
votes
1answer
162 views

Having problems accessing $_GET values

I'm trying to get the value of a $_GET variable on the homepage of my site. For some reason I can't access any $_GET variables on the homepage, but I can access them just fine on other pages. Does ...
0
votes
1answer
861 views

What does the Global Variable $s represent?

What does the $GLOBALS['s'] variable contain? It looks like an empty array, but what would it normally hold? I've encountered it in a tutorial: The WordPress Theme: Single Post, Post Attachment, ...
3
votes
3answers
2k views

How do I pass an argument to my custom walker?

I've set up a custom walker, and it works as desired when I hard code my variable. What I want is to be able to call my walker and pass it a variable that is used in the walker. For example: ...
0
votes
2answers
428 views

problem loading stylesheets to wp_head dynamically

I'm trying to create a wrapper shortcut function to register and load stylesheets in the header. currently, the function loads this css file src: http://my.test/wp-content/theme/css/.css I, ...
0
votes
1answer
75 views

Pass var into wp function instead of direct string text

Looking to replace static string text in this function with dynamic text from a var. Current model: comments_number( 'no responses', '1 response', '% responses' ); Ideal Outcome (code guess): ...
2
votes
1answer
891 views

How Can I Access a PHP Variable in Another PHP Function

I'd like to use the $atts variable from the lax_google_map_maker() function in lax_google_map_init(). How do I access it? I tried to 'globalize' it, but for some reason it didn't work. function ...
0
votes
1answer
134 views

Do I Need to Prefix Variables Inside Functions?

Sorry, this is a noob question. But, I want to follow the best practices. I read that functions and global variables should be prefixed in plugins. So, for example, myfunction(), should be ...
0
votes
1answer
519 views

SFTP define in wp-config.php

just wondering if theres a way to define sftp info in wp-config.php the same way you can with ftp. makes plugin adding a lot easier! best,Dan.
0
votes
1answer
195 views

Getting values from options page to css

i got an options page that needs to affects a certain (for now) css value.. i have about using php variables in css and creating custom global variables in wordpress but havent something easy enough ...
0
votes
2answers
1k views

Passing variables to new page

I'm trying to pass the variables to a new page, I made a function in my theme to get the results. Now when I use yelplist(); on the front page of my theme it gets the results and when i click on the ...
2
votes
1answer
473 views

dynamic external javascript generated using php

How to write an external javascript file with dynamic variable values generated using php from wp db values? So instead of using wp_localize_script for inline js variables, I'd like to use ...
0
votes
2answers
3k views

Get current page id, title, url, etc

Sorry but I get lost on Wordpress's codex. I am trying to add a mail this page sharing link and want to include some info from the page. In pseudo code is this possible? <a ...
2
votes
1answer
940 views

Moving variables from one page to another

How can I link to another WordPress page but move variables to it as well (preferably not through the address bar)? For instance, I have on one page a list of shops in which a user should be able to ...
1
vote
1answer
221 views

Using $themename Variables

Is it a bad idea to set your themename and shortname as variables to be used in the various functions of a theme? Example: $themename = mytheme; $shortname = mth; /** * Get our wp_nav_menu() ...
-1
votes
1answer
208 views

Need help, Passing variables with get_post_meta

$slider_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'slider'); $slider_thumb = wp_get_attachment_image_src( get_post_thumbnail_id( ...
0
votes
1answer
91 views

Need some PHP schoolin'! passing var to url and the old options table

So, I've been building a theme options page, one of the purposes of which is to get some style values to pass to my php stylesheet in the url. Here's what I have: /* Get all theme settings */ ...
1
vote
1answer
839 views

stop the_permalink printing and save as variable?

Is there a way i can get the_permalink as a variable? I need to build an info window with it but it wont appear in the $infoWindow variable... <? $link = the_permalink($post->ID); // prints ...
3
votes
2answers
774 views

Why does Wordpress Pagination Remove the Spaces from my GET Variable?

I'm passing a GET variable at the end of my URL's as my search parameter. When I do a regular search, everything works fine: www.mysite.com/?find=my+search However, when I click over to the second ...
0
votes
3answers
3k views

get variable from url?

say i've got a url http://bfami.modernactivity.co.uk/category/museum/orderby/date/order/desc/ that works with; add_rewrite_rule( ...
0
votes
1answer
947 views

get_term_by with a variable

I have a Custom template with a custom query. I want to use additional information about the current taxonomy > description and name (and use it in the HEAD, desc, keywords, etc...) <?php ...
1
vote
1answer
364 views

Can you keep session data for visitors?

I read that you can use session_start() in config.php, but that it is not recommended. I have a form where a user fills out their name and submits. On confirmation of the submission they land on a ...
0
votes
1answer
240 views

What's the best way to echo out a filter variable?

I have a plugin filter that isn't working for me: add_filter( 'gform_notification_email_3', 'route_notification', 10, 2 ); function route_notification($email_to, $entry) { global $post; ...
2
votes
1answer
5k views

Custom page with variables in url. Nice url with add_rewrite_rule

Using WP3.1 I Have a custom page with a WP_Query and the query gets dynamic variables from the url. And i want safe variables and clean urls. Example: ...
0
votes
3answers
311 views

Get attachment if matches a variable

how do I match an image title from the media library to a variable then echo that image? this is my current code... <?php $args = array( 'post_type' => 'attachment', 'numberposts' ...
0
votes
1answer
114 views

Preventing Duplicating Posts from Widgets

I am making a theme that has the main loop in a widget. Also widgetized is a feature slider and a display of four feature post boxes, each with their own loop. How do I prevent duplicate posts from ...
0
votes
2answers
2k views

When would you use $_post instead of $post?

I've seen some examples that use $_post instead of $post. What's the difference and when would you use $_post instead of $post? Example: if (have_posts()) : while (have_posts()) : the_post(); ...
1
vote
4answers
2k views

How to tell if $query_var isset?

I tired to use isset($queryvar) but that didnt work, so I implemented my own function qv_isset, but it runs into a problem when $ch is set to 0. $cls = get_query_var('cls'); $ch = ...
1
vote
1answer
155 views

Why does a variable work on the front page but return NULL on all other pages?

Hey all. For my theme, I have multiple sidebars. Each sidebar file has a variable of $sidebar_id assigned to it. So, for sidebar-1.php, $sidebar_id = 1, for sidebar-2.php, $sidebar_id = 2, and so on. ...
1
vote
1answer
347 views

Append varible to url or set session

I just wrote a little plugin that detects if the user is on a mobile browser and if so detects them away from the WordPress site to a mobile (simple) version of part of the site. As I got to ...
1
vote
2answers
813 views

Dynamic variable for custom taxonomy in loop?

I have a custom page template that loops through all custom posts with the post_type of "product_listing" AND the custom taxonomy "product_cat" of "shirts" and returns 4 posts per page (as seen ...