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

0
votes
2answers
317 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
159 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
504 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
5k 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
609 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
556 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
195 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' ); ...
3
votes
1answer
502 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
410 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
602 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
146 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
713 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, ...
1
vote
3answers
1k 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
391 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
73 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
643 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
126 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
396 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
188 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
452 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
787 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
192 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
199 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
90 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 */ ...
0
votes
1answer
744 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
702 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
2k 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
837 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
359 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
224 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; ...
0
votes
1answer
4k 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
302 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
111 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
1k 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
148 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
333 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
750 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 ...
3
votes
1answer
2k views

How do I make my function add variables/values to the $post object?

How do I add $tzDesc and $tzEmbed (and other variables) to the $post object in the following function so that I can display the values in my theme files by inserting <?php echo $tzDesc; ?>? ...
2
votes
1answer
2k views

Take Variables Set in Functions.php and Echo Them Inside My Custom Post Template

I have the following function set up in my functions.php file to allow my custom post type "Slideshow" to work. add_action( 'the_post', 'paginate_slide' ); function paginate_slide( $post ) { ...
2
votes
3answers
533 views

where to include a php file

I have a php file with some variables which I would like to use. When I include it in the header.php the variables in that file are not recognized at footer.php and some other places. Where is the ...
0
votes
1answer
340 views

How to add a new variable to blog creation form?

I'm trying to add a new INPUT field to the blog creation form on Buddypress. Adding the front-end element is the easy part. I'm having some hard time trying to save it. The variable is a string, and ...
1
vote
1answer
865 views

How do I pass variables into short-code enabled Post Snippets in Wordpress 3.0?

I am using a plugin called Post Snippets. According to the documentation, it can substitute variables, such as {url} within the snippets. http://wordpress.org/extend/plugins/post-snippets/ I am ...
9
votes
2answers
3k views

What are all the Properties of the WordPress Post Object?

(Moderator's note: Title was originally "What are all the variables in the wordpress post object?") Does anyone know the variables that are stored in the WordPress Post object?
0
votes
1answer
125 views

Defining the value of a variable before a function?

I'm trying to edit a plugin so that it only shows it's submenu if the user is an administrator but I don't know how to define the value of the variable before the function: function load_view( $name, ...
2
votes
2answers
659 views

How to pass data around?

I have different menu items. When the user clicks on a menu item, I want them to go to a particular destination. Each menu's destination has a different background color. I'm thinking that I can pass ...