get data from wp-query, outside the loop & without url change

It sounds like you’re looking for wp_localize_script() which lets you pass data to a script that is already enqueued. It works roughly like this: <?php // assuming your script is already registered wp_enqueue_script( ‘wpse_81817’ ); // Do the array building of terms you plan on doing $wpse_81817_phpdata = array( ‘myKey’ => ‘a value’ ); // … Read more

Query meta field using between

Your problem is this: CAST(wp_postmeta.meta_value AS SIGNED) Run a simple SQL query (command line or PhpMyAdmin, whatever you like) like SELECT CAST(‘1.2’ as SIGNED) and you will see that the value returned is 1. What causes that cast is ‘type’ => ‘NUMERIC’,. You can pass DECIMAL to meta_query instead of NUMERIC but I don’t see … Read more

Query by meta_key and order by meta_value_num return orderby date

The problem in your code is ‘meta_query’ code is write insde array of array $args = array( ‘post_status’ => ‘publish’, ‘post_type’ => ‘participant’, ‘order’ => ‘DESC’, ‘meta_key’ => ‘participant_partage_class’, ‘orderby’ => ‘meta_value_num, ‘meta_query’ => array(array( ‘key’ => ‘participant_partage_class’, ‘type’ => ‘SIGNED’, ‘compare’ => ‘>’, )), ‘posts_per_page’ => ‘8’, ‘paged’ => $paged ); $query = new … Read more

Adding Post Counts to Menu (Nav) Programmatically?

WordPress’ get_categories() function returns an array of category objects, each of which has a “count” property for the number of posts in that category. So something like this would get you a list of links to category pages: $categories = get_categories(); $markup = ‘<ul>’; foreach( $categories as $category ) { $catName = $category->category_nicename; $count = … Read more

How to get_queried_object on multiple objects?

You almost had it with $_GET[‘zap_audience’], but not quite, since it isn’t passed in as a GET variable. It is however a query variable, so try these: $post_type = get_query_var( ‘post_type’ ); $audience = get_query_var( ‘zap_audience’ ); $city = get_query_var( ‘zap_cities’ ); Also +1 for prefixing your taxonomy types with zap_