Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
You can use below code to add other two parameter as condition. $args = array( ‘posts_per_page’ => $postsCount, ‘post_type’ => $postsType->name, ‘order’ => ‘DESC’, ‘orderby’ => $postsOrder, ‘taxonomy’ => $postsTaxonomy, ); $postsOrder = get_sub_field(‘posts-ordering’); if ($postsOrder == ‘post_views_count’) { $args[‘meta_key’] = ‘post_views_count’; $args[‘orderby’] = ‘meta_value_num’; } $query = new WP_Query($args);
WP_Query search posts by custom post type and custom taxonomy
Try something like that The reverse of this: https://wordpress.stackexchange.com/a/209714/180599 <?php global $wpdb; //The reverse of this: https://wordpress.stackexchange.com/a/209714/180599 $supported_mimes = array( ‘image/jpeg’, ‘image/gif’, ‘image/png’, ‘image/bmp’, ‘image/tiff’, ‘image/x-icon’ ); $all_mimes = get_allowed_mime_types(); $accepted_mimes = array_diff($supported_mimes, $all_mimes); //and… $keyword = stripslashes($_REQUEST[‘keyword’]); //$search = $wpdb->get_col( $wpdb->prepare( ” SELECT DISTINCT ID FROM {$wpdb->posts} WHERE post_title=”%s” OR post_content=”%s” “, $keyword, $keyword … Read more
WP_Query sort using multiple numeric meta values
After fiddling and searching a bit I managed to have: ‘selected’ 10 posts on top ‘remaining’ posts below sorted descending by date Unfortunately the ‘selected’ posts are in descending order … here is my query: $args = array( ‘post_type’ => array( ‘projekty’, ‘publikacje’, ‘wystawy’, ‘wyklady’ ), ‘post_status’ => array( ‘publish’ ), ‘meta_query’ => array( ‘relation’ … Read more
How to output different posts per page?
How To Remove/hide some specific categories from two different categories widget from sidebar
There’s not a real efficient way to do this. You’ll either have to make 3 queries or create your own SQL query and use global $wpdb;. For simplicity purposes I’ve went with a 3 query approach. If we know the slugs or IDs we can pass them to our tax query. Since the example code … Read more
What’s the point of the query_vars filter?