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
1answer
743 views

Pagination for category slug returns 404 when page >= 2

I have a custom type and the slug is: 'rewrite' => array('slug' => 'blog/%blogs_tax%'), And after register_post_type() I have a function to rewrite the slug variable. I works fine, but I ...
0
votes
1answer
618 views

Apply class to every third list item? [duplicate]

Possible Duplicate: How to mark every 3rd post I'm trying to give a class to every third list item on my page. I know how to give a class to every item, but not to specific items in a row, ...
1
vote
2answers
95 views

How do you Query posts with nothing in common?

We can get multiple posts manually in a page, but that's generated in a template, AFTER the default query returned something else (page/post, etc) How do you query multiple posts in a public query, ...
-2
votes
1answer
83 views

Using Form to alter PHP variable [closed]

I'm pulling custom posts by their meta_key using this function: <?php $args = array( 'numberposts' => 10, 'meta_key' => 'allvotes', 'orderby' => ...
0
votes
1answer
106 views

Extracting a variable from a permalink

I used the "Edit Author Slug" plugin to change the author base to /newbase . In the functions.php file, I added a new node to the toolbar (View Profile) that when clicked points to ../newbase/johndoe ...
-2
votes
1answer
474 views

How do I access variables outside a function [closed]

I have a custom function which defines a bunch of variables. I would like to be able to call this function from inside a loop so I can have access to all its variables, like so: functions.php ...
0
votes
1answer
549 views

Passing a variable from a FOREACH loop in a link

How would you pass a variable from a foreach loop, through a link? I have tabs that display correctly. The jQuery works. But when I call the variable $category down where the content sorts, $category ...
0
votes
1answer
1k views

category__not_in and id values from variable

How can I set the values for category__not_in from two variables. On my example I just hardcode the ID of each category to exclude, but... how can I pass these values from some variables ? ...
1
vote
1answer
173 views

Use post object from first query in second query

I have a post ID stored in a variable from my first query and I'd like to use that to highlight the post with the same ID in my second query, but it's not working. First loop: <?php if ...
1
vote
0answers
145 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
537 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
80 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
227 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
196 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
532 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
8k 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
727 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
717 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
227 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
694 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
506 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
770 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
163 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
869 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
432 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
910 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
535 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
196 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
481 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
4k 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
959 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
226 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
853 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
783 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
959 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 ...