Get posts that match defined arrays of tags

This should be achievable with a taxonomy query, like this: $query = new WP_Query( [ ‘tax_query’ => [ ‘relation’ => ‘AND’, [ ‘taxonomy’ => ‘post_tag’, ‘terms’ => $platforms, ‘compare’ => ‘IN’, ], [ ‘taxonomy’ => ‘post_tag’, ‘terms’ => $hashtags, ‘compare’ => ‘IN’, ], ], ] ); You just need to substitute the $platforms and $hashtags … Read more

order posts by a secondary query that counts items

The way to go is apply custom filters to the WP_Query you are running. add_filter(‘posts_clauses’, function ($clauses, $query) { global $wpdb; // only run the filter for a given query // do your checks and return early if (!$query->is_main_query() || !$query->is_post_type_archive(‘tracklist’)) { return $clauses; } $clauses[‘fields’] .= “, COUNT(items.id) AS track_count”; $clauses[‘join’] .= ” LEFT … Read more

How can I query and sort custom-post type using WP_Query

You should add arguments to WP_Query to sort by your keys in the order you want. The compare value can be your filter (larger, smaller, etc) $args = [ ‘meta_query’ => array( ‘relation’ => ‘AND’, ‘event_start_date_clause’ => array( ‘key’ => ‘_game_date_key’, ‘compare’ => ‘EXISTS’, ), ‘event_start_time_clause’ => array( ‘key’ => ‘_game_home_goals_key’, ‘compare’ => ‘EXISTS’, ), … Read more

Assign meta_query value to php variable

Sorry if I’m being dumb but your query says that br_type must be equal to esc_attr($values[‘category’]) so to put it in a variable you would just: $br_type = esc_attr($values[‘category’]); Or if you want to get it from $query you would look in one of the places mentioned here: How do I get a meta value … Read more

Change normal grids to masonry grids

This is not really a WordPress issue, you will have to play around with the CSS to get the layout you desire, if you take a look at isotope.js library you will see that hey have documentation on how to display Masonry grid https://isotope.metafizzy.co/layout-modes/masonry.html , and if that doesn’t fit your needs you can learn … Read more