Articles of variables

Is it possible to pass variables to WordPress externally?

I would like to know if it is possible to pass json variables from a form which is located outside WordPress? This is the situation: The user fills a form located on x server. Then his answers are sent to the WordPress site located in Y server in which depending upon his answer he will […]

How to pass a PHP $_GET variable and fetch/output it?

I’ve already looked at the WordPress Codex, and looked around for other solutions online, but i still can’t seem to get it working. Basicly what i need is to pass a GET variable in an URL, and output it on the next page. Link http://www.website.com?foo=bar I’ve aleady tried fetching the GET variable like below: $foo […]

Easy reading or transfer of data from posts?

Plugin usually transfer data using code like [espro-slider id=21] , is there a short way to read it or do they use regex to read it. If not is there a short way to define variable in post and use it directly in back-end. I am trying to read information from post and use it […]

How to add multiple custom URL variables?

I am building a WordPress plugin that looks for different custom variables in the URL. The way I am able to achieve that right now is with this code: function add_custom_query_var( $vars){ $vars[] = “variable1”; return $vars; } function add_custom_query_var1( $vars1){ $vars1[] = “variable2”; return $vars1; } add_filter( ‘query_vars’, ‘add_custom_query_var’ ); add_filter( ‘query_vars1’, ‘add_custom_query_var1’ ); […]

Pushing Category and Publish Date to Google Analytics

I have found an interesting article about tracking variables with JS based statical system (for example Google Analytics). The article writes examples like: _gaq.push(‘setCustomVar’, 3, ‘pubDate’,’YYYYMM’,3); _gaq.push(‘setCustomVar’, 4, ‘contCat’,'[CATEGORY NAME]’,3); _gaq.push(‘setCustomVar’, 5, ‘contSubCat’,'[SUB CATEGORY NAME]’,3); But how can I get the actual value of the pubdate from the PHP environment of WordPress and write it […]

Query Products & Store IDs in array

I’m attempting to query Products in WooCommerce and return their IDs as an array that can be used to filter conditionally. I’m using ACF Pro to add custom fields into the product, for which I’m then using conditional code. I spoke to my developer friend, who suggested this approach which should store the array in […]

Where's the explanation of the TinyMCE's vars in the WP core?

I am modifying my TinyMCE editor for my users, and I’m using the example in the docs as a starting point. function my_format_TinyMCE( $in ) { $in[‘remove_linebreaks’] = false; $in[‘gecko_spellcheck’] = false; $in[‘keep_styles’] = true; $in[‘accessibility_focus’] = true; $in[‘tabfocus_elements’] = ‘major-publishing-actions’; $in[‘media_strict’] = false; $in[‘paste_remove_styles’] = false; $in[‘paste_remove_spans’] = false; $in[‘paste_strip_class_attributes’] = ‘none’; $in[‘paste_text_use_dialog’] = […]

Action 'init' function doesn't return variable

I have a function which checks if $_POST is set (a form which submits to the same page). I need to have it initialized before the page is loaded because the function will do a header redirect if the validation goes through without errors. So the function is registered like this: add_action(‘init’, ‘signup_validate_insert’); And the […]

Validate form in functions.php, send errors back to template

I have a form in a template that upon submission should be validated, and any errors should be displayed, and if no errors, insert the data into the database. I’m new to wordpress, but my idea was that maybe an “action” could solve this. So I have a function in functions.php: function signup_validate_insert($errors){ if (isset($_POST[‘submit_msg’])) […]

echo var into wp_query

Im trying to echo out a value grabbed from a ACF field but I think im doing something wrong, could someone help me? <div class=”news”> <div class=”container”> <div class=”row”> <?php $selected_cat = get_field( ‘select_new_category_for_page’ ); $args = array(‘post_type’ => ‘post’, ‘posts_per_page’ => 1, ‘cat’ => $selected_cat); $Query = new WP_Query($args); ?> <?php if ( $Query->have_posts() […]