New answers tagged

1

If you don't want to include posts in child categories, use the category__in parameter: $args = array( 'category__in' => [ get_cat_ID( $category_name ) ], // use category__in //'category_name' => $category_name, // and not this. 'post_type' => 'menu', 'numberposts' => -1, 'post_status' => 'publish' ); And although ...


0

Yes, and you can use the meta_key along with meta_value parameter. Secondly, you're going to need two queries when there are no featured posts: Query the featured articles/posts: $q = new WP_Query( [ 'post_type' => 'post', 'meta_key' => 'featured', 'meta_value' => '1', 'posts_per_page' => 3, 'no_found_rows' =&...


Top 50 recent answers are included