The variables tag has no wiki summary.
0
votes
1answer
29 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
19 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
17 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.
0
votes
1answer
138 views
How do a 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
1answer
330 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 ...
1
vote
1answer
278 views
How to pass on Google Adwords gclid variable to other pages
i need to track if people filled out any of my forms on my wordpress blog if they where coming from a Google Adwords ad. There are many forms on my website like for booking a demo presentation, ...
1
vote
1answer
345 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
82 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
9 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
59 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
116 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
212 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
57 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
28 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
78 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
39 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
51 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
55 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
178 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
146 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
29 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
32 views
Checking for a null value in conditional [closed]
I have found there to be multiple ways to check whether a function has correctly returned a value to the variable, for example:
Example I
$somevariable = '';
$somevariable = get_somevariable();
if ...
-2
votes
1answer
38 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
27 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
90 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
66 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
33 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
69 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
43 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
39 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
1answer
279 views
Can't get options with $data['variable']
Can't get options with $data['variable'].
(I'm use SMOF - Slightly Modded Options Framework)
For example in the header.php (index.php, footer.php, etc.):
global $data;
$logo_type = stripslashes( ...
0
votes
2answers
1k 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
573 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
48 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
347 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
80 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
593 views
Variables and custom permalinks using wp_rewrite [closed]
I want to get safe variables and clean urls using wp_rewrite.
Example:
/%category%/%postname%/?action=play
to
/%category%/%postname%/play/
Still can't find solution. Everytime get 404 error. ...
0
votes
1answer
73 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
92 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
240 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
71 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
322 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
174 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
2k 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 ...
1
vote
2answers
549 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:
...
1
vote
3answers
592 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
94 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
592 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
469 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
126 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',
...