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

Cron Job variable not accessible

I am currently running a cron job on my cPanel to update a variable containing exchange rates, how can I make this variable available to functions and pages in my wordpress site? My command in cPanel ...
0
votes
0answers
298 views

Pass a variable between WordPress Custom login and BuddyPress registration page

I am coding a custom WordPress template that has to be also BuddyPress compatible. Actually when BuddyPress is Disabled my custom login/registration form works without problems but, as soon as I ...
0
votes
2answers
190 views

What is the $current_screen global variable?

What does it mean by a screen? I've had a look in the codex and don't understand (I'm a newbie). Thanks.
1
vote
1answer
522 views

Use <?php echo $_GET['ref']; ?> to track referrals

I am setting up my wp site and i have it setup like this www.mydomain.com/?ref=AFFILIATEID thats alright if they land on the page they are directed to but if they go off page onto another one, how do ...
1
vote
2answers
91 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, ...
0
votes
0answers
21 views

Advice or Best Practice on setting attributes and properties for user on login

I’m working on a web application service which is going to use a lot of the built-in Wordpress functionalities but also relies heavily on some customized code and tables to create - among others - ...
0
votes
1answer
90 views

Custom Post not working as expected

NEW EDIT I solved it, as written in answer, the problem where that variables are 'forgotten' (not so techy I know, sorry for this) when function starts. EDIT: I found the problem is this: ...
6
votes
2answers
145 views

Wordpress variables and memory

When checking get_defined_vars() on an empty template file my theme loads over 70000 lines of output. Before even including elements on a page all of this is loaded. Is this correct? Is there any ...
-1
votes
1answer
1k views

Use conditional logic for woocommerce variable product

I have been developing a woocommerce store. Now I have a requirement from client which I can't figure out how to do... The problem is we can use variable product in woocommerce, it's simple but what I ...
0
votes
0answers
174 views

Why won't the action hook wp_head won't accept parameters?

I'm working on a plugin that adds scripting to the head using add_action('wp_head',..); I have to pass a variable to the function to get my desired result. To test this I'm simple "echoing" out the ...
0
votes
0answers
45 views

Displaying posts by year

I'm trying to display posts on the homepage from the current year only. I am using the following: <?php if ( is_front_page()) { ?> <?php $current_year = date('Y'); ?> <?php ...
0
votes
1answer
324 views

No access to global variables?

In main.js, I have a script, which is sending an ajax request to script.php. $.ajax({ type: "POST", url: "wp-content/themes/roots/script.php", data: registerdata, success: ...
0
votes
1answer
54 views

How to use shortcode inside of shortcode in theme

I am trying to place a shortcode inside another shortcode within a page template, however the various attempts I've made seem to not do anything. Here's how my code looks now - <?php echo ...
0
votes
2answers
392 views

IF Custom field value equals ZERO

I am trying to use the following code to check for my custom field for a value of ZERO to then display my div <?php $mp_price_sort = get_post_meta('mp_product_price'); if ($mp_price_sort == '0') ...
0
votes
0answers
239 views

Use $_GET with permalinks on page

I'm currently trying to use a $_GET to populate a MySQL query with in a URL on another page within a Wordpress site. URL sample: <a href="http://site.com/file.php?alabama">Alabama</a> ...
1
vote
2answers
899 views

How can I Add a variable PHP in the Menu Nav

I want to add a variable in the Menu, for passing a value in all my page. The purpose is to retrieve a value for transport to another web site (from my website links) to the tracking, this value ...
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
66 views

Using Output from one Function and calling it into another

I'm trying to get my head around a fairly simple concept in PHP but I'm pretty green. I have a function.. function pa_insertPage($atts, $content = null) { // Default output if no pageid given ...
-2
votes
1answer
40 views

How do I echo saved data outside the function?

I know the data I want is stored as $lineOne and I can echo that inside the function. But I want to get the data outside of the function. I've tired: $lineOne; $instance['lineOne']; Here's the ...
0
votes
1answer
58 views

add_menu_page() with variable function

How can I use add_menu_page() functions some variable function ? add_menu_page('My page','My page','manage_options','my_page', 'func' ); $func = function() { echo "Done !"; }; I know I can ...
0
votes
1answer
179 views

Shortcode with multiple variables

I'm trying to create a shortcode to insert the Pinterest button with variables manually in posts. This is the code I've arrived at after reading various posts and grabbing the code from Pinterest. I ...
0
votes
1answer
132 views

How to access a variable on all page?

I added a variable to my functions.php file: $options = get_option( 'simple_options' ); I can access to this variable on every page, but If I call it in the footer.php it's not working. How to fix ...
0
votes
1answer
72 views

Shortcodes and a list of IDs?

I'm creating a simple shortcode function and need to specify a list of IDs as a variable. I've checked the Codex but I'm not sure how this is handled. The shortcode is: [video_vote ...
1
vote
1answer
124 views

WP_Query Variable inside Array

The array below with "'taxonomy' => 'age'" isn't working, if I copy and paste the array "array( '19', '20' )" in place of the variable it works fine. I just started picking up PHP so go easy on me :) ...
0
votes
1answer
57 views

Trying to get variables in hacked category dropdown

I've discovered a workaround to get wp_category_dropdown to display as a multiple select field. My code is as follows: <?php $sponsors = wp_dropdown_categories( array( 'child_of' => 0, ...
0
votes
2answers
55 views

Child Theme Variables

In my theme, I used this: <div id="brickwall" data-brickinvert="<?php echo brickAlign(); ?>"> I put the code into functions.php: function brickAlign() { $a = "true"; return $a; ...
0
votes
2answers
4k views

How to set global variable in functions.php

I want to be able to echo the URL of the featured image of a post and after looking some on the web I found the following which works fine when I put it in a loop in my front page template. <?php ...
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
2answers
80 views

Passing variables trough 2 pages

I am creating a plugin. In this plugin I have shortcodes that provide some logic and content for pages. This way I have created 'Page A' and 'Page B'. Both of the pages will redirect user to external ...
0
votes
1answer
739 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
2answers
212 views

Retrieve the template directory URI via global or get_template_directory_uri() every time?

One Wordpress function I happen to use frequently is get_template_directory_uri(). While I tried to minimize or avoid its use where I can, I still happen to have more than one call to this function in ...
0
votes
1answer
98 views

About redundant code when I use shortcode to output the HTML from a variable

I use shortcode to output the following html in a variable, but there are too many redundant code such as br and p tags, how to remove them? Thanks! HTML MAKEUP $return_html.='<div ...
1
vote
1answer
139 views

Escaping date string in url with wordpress

I am creating a Wordpress page that searches through posts based on a date variable that is set through a _GET variable. I want to make sure that I am doing this in the best way possible and that I ...
0
votes
3answers
594 views

Adding numbers inside a span tag in nav menu [closed]

I am working on a wordpress navigation menu and trying to simlpy (of course, dynamically) add number inside a span tag for each menu li item. So I created a "top menu" using the wordpress custom ...
0
votes
2answers
87 views

update_option using variable name

Title may not be clear but I'm using update_option($my_option, $new_order); and for some reason it would not work but if instead I change to update_option('my-option-name' $new_order); it works. I ...
0
votes
1answer
449 views

Using custom url parameters in a page

Im trying to create a custom image galleri that retrieves images from posts as can be seen here http://kurdaktuellt.se/galleri/ problem in hand is that I'm trying to make the url somewhat user ...
0
votes
1answer
200 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 ...
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 ...
2
votes
3answers
888 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 ...
0
votes
1answer
134 views

jQuery dialog prints HTML-Tags under Wordpress

i need some help. I am using wp_localize_script in my Wordpres_Plugin. Inthe documentready-function i use this Code to bring the Message up: $('#button-setup-league').click(function() { $( "#dialog ...
2
votes
1answer
785 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 ...
-2
votes
1answer
582 views

Use ajax response in PHP function

Ok, so I'm working on a plugin and just ran into a problem. Here's what I'm doing: 1. Using a metabox with Plupload to upload an image to an upload dir in the plugin folder. 2. Upon upload success a ...
0
votes
1answer
227 views

assign the returned value of wordpress function to a variable?

Why can't I store wp_list_categories in a variable? $wplist = wp_list_categories( array ( 'taxonomy' => 'ntp_package_type', ...
0
votes
1answer
449 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, ...
-2
votes
1answer
82 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
93 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
274 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
390 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 ...
1
vote
1answer
149 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
97 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 ...