Select Unique Posts for a List of Tags
Select Unique Posts for a List of Tags
Select Unique Posts for a List of Tags
You did not include wp_reset_postdata(); after the while loop.
This cannot be done only by querying database. Firstly, you have to iterate through all items and create array of posts grouped by dates. $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘event’, ‘meta_key’ => ‘event_date’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’ ); $wpquery = new WP_Query($args); $posts = $wpquery->get_posts(); $ordered_posts = array(); foreach ($posts … Read more
It’s pretty easy actually in your single-event.php file within the content loop. add this loop where you want your speakers information to show. $event_title = get_the_title(); // This is the title of the current single event page we are on. $args = array( ‘meta_key’ => ‘event_name’, // the name of your custom field ‘meta_value’ => … Read more
How to combine nested tax_query logic with other nested query logic?
It appears that the WP_Query was correct. I am hosting with WP_Engine and I had to contact their support desk and have the ticket elevated to resolve the issue. Apparently the query, even with the ‘orderby’ => ‘rand’, was being cached by their servers. I should have contacted them earlier, but I thought it was … Read more
Your query seem to fall outside of realm what’s “normal” for WP APIs to do. There are two general approaches to it: Keep it completely in SQL. If you can figure out how to adapt it to WP’s schema you can use $wpdb->get_results() to run arbitrary query, get what you need, and proceed from there. … Read more
category__not_in is a private query var. This means you can only use it when constructing a query in PHP, not in a url. You would have to construct your own custom public query var and bind that to a filter that reads the category and then changes the query accordingly.
It looks like you want to order by post__in: $samp = array ( ‘post_type’ => ‘product’, ‘posts_per_page’ => 12, ‘post__in’ => $init_ids_arr, ‘orderby’ => ‘post__in’, // <– Try this to fix the order ); We might also want to skip the sticky posts with: ‘ignore_sticky_posts’ => true, If we want to display all of the … Read more
Combine WP_Query with array of custom data to single loop without breaking the pagination