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
0answers
23 views

Pass variable to next page

I'm putting simple breadcrumbs in a site, based on a custom post's category. Items > Category > Individual Post "Items" doesn't change, it's just plain text. In the Category page it's title is ...
0
votes
2answers
26 views

Global Variable vs Local Variable

// MOVE REVISIONS METABOX TO BOTTOM OF EDIT-FORM.PHP $post_types = get_post_types(); add_action('do_meta_boxes', 'batteryboys_reorder_meta_boxes'); function batteryboys_reorder_meta_boxes(){ ...
0
votes
1answer
20 views

how to add number value in front for variable [closed]

Hi there my question is very simple, is there a way by which we can add a value in the end of the variable a numeric value. like we have a variable $tota $tota1 $tota2 $tota3 each have different ...
0
votes
2answers
49 views

Passing PHP Variables to AJAX Loaded Pages

I have a blog that shows 9 blogs posts per page, with each additional page of blog posts automatically added using the Infinite Ajax Scroll plugin. Every time a blog post is successfully queried the ...
0
votes
1answer
22 views

Class variables in shortcodes

Don't know what I'm doing wrong but, I have the following code: class the_shortcode { //Define Class Variables private $var; public function __construct() { ...
1
vote
1answer
39 views

Add classname comment template from functions.php

I want to add an extra classname to my comment template (the div wrapper before the post itself) which is stated in functions.php. The classname in functions.php is an extra field in my users profile ...
3
votes
2answers
48 views

When to use global $post and other global variables?

I am trying to understand when and why I should use the global $post variable. I have tried to do the following on a post page, outside the loop, and as expected it works. <?php ...
0
votes
2answers
42 views

Shortcode not passing variable to included file

I set up a shortcode which includes a standard php/html form file. In the form I have a hidden field where the value is a variable which is meant to be available in the form via the shortcode ...
0
votes
1answer
10 views

How can I assign bloginfo path or thumbnail path to a variable and call it in markup?

In my head this sound right. I check if the post has a thumbnail. If it has, I assign the post thumbnail to a variable that I call as the source for my background image. If the post does not have a ...
0
votes
0answers
42 views

setcookie in functions.php does not accept arguments (variables) passed from WordPress page

I have a WordPress installation where a page (Page 1) displays certain fields from a selected user's profile (Not the logged in user but a user they have selected). A PayPal button is used to take a ...
-1
votes
1answer
50 views

Enter a variable in the 'category_name' parameter

Is it possible to use a variable for the 'category_name' parameter? I have three pages: red, yellow, and blue. I have multiple posts that are categorized in three categories: red, yellow, and blue. ...
0
votes
0answers
24 views

stuck in $args value insertion how to pass more than one value

I am in a middle of building a plugin and some how I manage to limit profiles to show only with the users with role regular_user by putting this line in my code $args['role']='regular_user'; ...
0
votes
1answer
45 views

Adding to an array & passing it through do_action/apply_filters

For exercise I am working through a PHP class to add meta boxes I found on GitHub. I just copied the code and now I am playing around with it to understand it. It works like this: The file ...
0
votes
1answer
26 views

Can I get variable into dynamic sidebar?

How can I get a variable into a sidebar? $sidebarnum = 4; dynamic_sidebar('Footer Widget $sidebarnum'); ?>`
0
votes
1answer
24 views

Replacing string with a variable in php

I have following code in my plugin of Wordpress: wp_localize_script('ffd_js_script', 'myAjax', array( 'ajaxurl' => admin_url('admin-ajax.php'), 'idinfo' => ...
0
votes
1answer
76 views

Variable scope producing undefined variable notices in included files

I'm building a Wordpress Theme and on the front page the user is able to select how they would like to order their posts. I've then created two functions that take the users selection through the ...
0
votes
0answers
46 views

passing javascript variable into php wordpress

I am trying to pass variable from JS to PHP. I have this JS code that runs in my footer.php: <script> function printResponse(response) { if ( response.errorCode == 0 ) { var ...
0
votes
1answer
127 views

Cleaner way to define multiple variables for is_page_template()

I need to so some stuff only when specific templates (homepages) are used, I couldn't think of any better solution than this since is_page_template() do not handle arrays: $home_1 = ...
0
votes
2answers
77 views

How to add chunk of php, html, and sql code to variable an append to $content

I am creating a plugin (my first) which allows the site admin to display the most used post tags over the last X number of days. This plugin is an evolution of the WP Development question here - ...
0
votes
1answer
44 views

$before/after_widget/title not displaying anything

I have built a custom widget with this code: class rfw_dock extends WP_Widget { function __construct() { parent::__construct('rfw_dock', __('TITLE'), array( 'description' => __( ...
0
votes
1answer
224 views

Passing variables from header.php to template and vice verca

I've defined a variable - let's call it $header_var, which is placed in the header.php file. I would like this variable to be passed onto my template file (in this case taxonomy.php). Also I would ...
0
votes
0answers
17 views

wp_localize_script() dont parse values

I try to parse php values to js file using wp_localize_script() wp_enqueue_script( 'countdown_js', plugin_dir_path( __FILE__ ) . 'js/countdown.js', array(), '1.0.0', true ); $dataToBePassed = ...
0
votes
2answers
104 views

Print string to footer using wp_footer option

add_action('wp_footer','slider_option'); function slider_option() { $option ="<script>script function data </script>"; echo $option; } I want to print or ...
0
votes
1answer
312 views

Passing variable as permalink URL

I've been trying to adapt the rewrite functions described here with little success: Passing variables through permalink structure WordPress permalinks and custom $_GET Variables The structure of ...
0
votes
1answer
89 views

Current URL path variable

WordPress has a built-in variable $pagename that will give the current page. I am looking for something that will give the full url including the path before the current page. Details below. I am ...
0
votes
1answer
131 views

Widget checkbox array empty on update function

I have a widget that is not passing checkbox state to $new_instance, specifically $instance[ 'posts' ]; if I dump $new_instance in the update function it is empty? All the other instance variables are ...
0
votes
1answer
219 views

Variable undefined but it is defined

I have an author list that I include on every page template. This author list shows the authors details and photo. I also show the author images on many different place on the different page ...
0
votes
1answer
34 views

Declaring a var, placing it in a query and using the output of the query?

So i'm wondering if it's possible to declare a variable that you'd place in a query to then use it in a update_post_meta function? This is how I tried to do it. First off I made a connection to ...
0
votes
0answers
48 views

Working with arrays/foreach statements - echo results? Addition operator w/foreach… multiplying?

I'm really struggling with this - I'm relatively new to PHP but I'm trying make this code that I've pulled together output a list of chapters sorted by user pageviews based on a user_meta field called ...
1
vote
2answers
126 views

Using Multiple Queries of “home_url” vs. Calling a Variable Multiple Times

Question Since I am using multiple instances of home_url() in one page template, I was curious if the following method would speed up my page load time. My method is to store the output of home_url() ...
0
votes
1answer
50 views

How Does One Create a Global Variable Repository

This may have a simple answer but I would like to store all the variables I've declared ( or cached ) across my theme in a central file and serve then this file globally ( Similar to how get_header(), ...
0
votes
1answer
237 views

How to append a query string to pagination?

I would like to append 2 variables from page 2 onwards in my loop. This is my normal category page www.example.com/category/news/ This is what I would like on pages: 2, 3, 4, 5 etc ...
0
votes
0answers
277 views

Passing variables through a href link from one page to another page

On my registration site I have a CPT called "event". In my "Events" page I list these events and create a "register" link for each one towards the "Registration" page: $events = new WP_Query( array( ...
0
votes
1answer
114 views

Shortcode and variable

I need some help, this may be a noob question, I am trying to add a string variable into my short code. Here is what I have so far: $instagram_title = get_post_meta(get_the_ID(), 'instagram_title', ...
0
votes
1answer
22 views

Remove # from a Variable [closed]

I am using WordPress WooCommerce plugin as a store management. When I echo with <?php echo $order->get_order_number(); ?> I get #6453 as a result but I need only numbers so how do I strip out ...
1
vote
0answers
23 views

How to return Javascript variable to wordpress [duplicate]

I use this Javascript code to create a dialog box to ask some thing to user and after decide what to do depending of the response. function dialogToCont() { var retVal = confirm("Do you want to ...
1
vote
2answers
107 views

Access the environment of an admin page from another admin page

I've been busy thinking about a problem, and so far I didn't find a solution to it. The abstract scenario On admin page A, I would like to print the value of a (global) variable—in the context ...
0
votes
1answer
444 views

How to pass post title (which could include &) to Gravity Form

I have created a form (Gravity Form) which I want to be able to complete dynamically from several of my other websites. In such a case, one of the fields that I am trying to send to the form is the ...
0
votes
1answer
16 views

Incorrect Blog Root

I have a blog at http://leghumped.com which I moved from a subdirectory to the site root a few months back. The problem is, the root still seems to resolve to /blog/. Eg: Instead of seeing ...
2
votes
1answer
51 views

How do I know what variables are passed in a filter/action and what their meaning is?

Something I have seen several times now and I don't understand is the following: In a theme's functions.php a function is defined and then attached to a hook, like so (simplified example): function ...
2
votes
2answers
89 views

WordPress filtering utm_ GET variables from url unless logged in as admin, not sure why?

So I am having an issue where I can't pull variables such as mysite.com/?utm_campaign=testing unless I am logged in as admin or editor. When logged out and just a regular users I can't grab any ...
0
votes
1answer
744 views

Passing variables through permalink structure in custom post types

I'm having a real headache with this one, and not sure what to try. Basically, I'm building a website with a custom post type of 'charities'. There are many charities listed, we'll use RSPB as an ...
0
votes
0answers
124 views

Create and update Custom Cookie based on multiple GET and POST Values for first time visitors?

I am not exactly sure the most efficient way to write this code. I collect custom data in my forms and also in my url via get such as: Name utm_campaign URL Referrer ID Among many more. Do I ...
0
votes
0answers
125 views

global variable not accessable inside functions

I downloaded and installed a wordpress plugin. Everthing works fine on localhost untill i uploaded the site on live server it wasn't working as intended. When i define a variable as global its value ...
3
votes
1answer
225 views

Using Wordpress public query variables

Good morning. I am trying to query various Wordpress pages, using public query variables, for example http://dmkim1979.ru/?p=37 // single post http://dmkim1979.ru/?page_id=40 ...
1
vote
1answer
139 views

Can wp_list_comments output into variable?

Is there any way how to output wp_list_comments() into a variable? Something like $output = wp_list_comments(array('reverse_top_level' => false ), $comments); I am writing a plugin and it would ...
1
vote
1answer
2k views

Use of global variables within plugin [closed]

I am creating my first plugin ever and I found my self having to call the same option variables within various parts of the same page therefore I sought for a solution and stumbled upon global ...
1
vote
2answers
339 views

Passing values from a widget to a function within a plugin

I have a plugin that is built with many widgets. A widget's bundle. Each widget creates it's own custom CSS code. Instead of having messy source code where I display 15 different sets of inline CSS ...
0
votes
2answers
417 views

WPDB SQL query with prepare() returning variable, not db value

I have been trying to get this to work for awhile now and I cannot seem to get any farther on my own. It seems to work fine as a normal SQL query but not within the WP framework using prepare(). ...
0
votes
1answer
25 views

Variable not staying set

This is most likely just a PHP problem, and it's probably a pretty simple answer, but I just can't seem to get my brain to function this morning. This is what I'm trying to do: $job_file = ...