Changing sort order for presentation by Jetpack infinite scroll
Changing sort order for presentation by Jetpack infinite scroll
Changing sort order for presentation by Jetpack infinite scroll
Filter posts by advanced custom field
you are not showing $quantity, maybe that is off? this one here definitely works: $args = [ ‘post_type’ => ‘product_variation’, ‘posts_per_page’ => 100, ‘meta_query’ => [ [ ‘key’ => ‘_stock’, ‘value’ => 0, ‘compare’ => ‘>’, ‘type’ => ‘NUMERIC’ ] ] ]; $query = new WP_Query($args); with this query, you get all variations, that are … Read more
If you want to target meta key vendor and meta value farsi, you need to pass the following meta_query arguments: $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘product’, ‘meta_query’ => array( array( ‘key’ => ‘vendor’, ‘value’ => ‘farsi’, ) ) ); Also to note, as Jiten highlighted, your meta key may be wpcf-vendor.
I think that what you’re looking for is this: <?php $tours = new WP_Query(array( ‘post_type’ => ‘tour’, ‘posts_per_page’=> 12, ‘meta_key’ => ‘tour_price’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’ )); Descending means going down, as in, high to low. Ascending is going up, low to high.
Dave, your code seems good except a couple things in it, so please try it: function exclude_featured_post( $query ) { if ( is_front_page() && $query->is_main_query() ) { $meta_query = $query->get(‘meta_query’) ? $query->get(‘meta_query’) : array(); // append yours $meta_query[] = array( ‘key’ => ‘featured_post’, // please make sure that key is correct ‘value’ => ‘1’, ‘compare’ … Read more
It’s not possible without a more custom query/filter. I have achieved it with a filter (code taken from this guy on this gist – https://gist.github.com/elvismdev/61f8509eff8abcc21ef84154b74fbf56) function f1_egpaf_meta_or_tax( $where, \WP_Query $q ) { // Get query vars. $tax_args = isset( $q->query_vars[‘tax_query’] ) ? $q->query_vars[‘tax_query’] : null; $meta_args = isset( $q->query_vars[‘meta_query’] ) ? $q->query_vars[‘meta_query’] : null; $meta_or_tax … Read more
Modify wp-query and sort by post meta key
There is no official documented list of all possible post meta keys in core. The closest I could for anything unofficial was this answer on Stack Exchange: You probably don’t want to use the following post meta keys: _thumbnail_id – Used to store the featured image ID _edit_last – Used by the Heartbeat API _edit_lock … Read more
Using meta_query and tax_query at the same time