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
3answers
333 views

How to put a form with php code into a variable or shortcode?

I'm trying to put my frontend form into a variable or a shortcode so I can wrap another shortcode around it (specifically Bainternet Post Creation Limits). My form has PHP code in it so I'm not ...
0
votes
2answers
74 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
2answers
94 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 ...
3
votes
1answer
223 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 ...
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() { ...
0
votes
1answer
43 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
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
72 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
1answer
206 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
1answer
308 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
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 ...
0
votes
1answer
144 views

Intercepting $_GET variable from custom pagination

I have a custom pagination using a form with the get action so I can have a page jumper box. Everything works until you enter something that is not an actual page. Examples are negative numbers, text ...
0
votes
1answer
34 views

Difference in Get Variable Location

I have noticed that in some instances in WordPress (such as in my custom post types), GET variables appear as following in the URL: www.url.com/events/cool-event?action=edit&message=1 However, ...
0
votes
1answer
267 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
1answer
110 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 ...
0
votes
1answer
152 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 ...
-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 ...
-2
votes
1answer
43 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 ...
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
0answers
37 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 ...
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
0answers
45 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
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
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 ...
0
votes
0answers
273 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
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
124 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 ...
0
votes
0answers
93 views

Passing user first and last names from external db to WordPress user first and last names using session variables?

This may be a little convoluted, but here it goes. I don't let users register on WordPress to access my member site. I have an outside registration/login system set up and want to continue using ...
0
votes
0answers
59 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 ...