Include custom post type that matches taxonomy field in another custom post type
Include custom post type that matches taxonomy field in another custom post type
Include custom post type that matches taxonomy field in another custom post type
How to short circuit a wordpress query that is not related to posts?
You are right to say: Never use query_posts anymore pre_get_posts pre_get_posts is a filter, for altering any query. It is most often used to alter only the ‘main query’: add_action(‘pre_get_posts’,’wpse50761_alter_query’); function wpse50761_alter_query($query){ if( $query->is_main_query() ){ //Do something to main query } } (I would also check that is_admin() returns false – though this may be … Read more
WP_Query filtering in ACF field containing dates
When you set WordPress up with: The set-up Custom Permalink Structure: /blog/%postname%/ Category base: blog Generated rewrite rules WordPress generates these rewrite rules: blog/([^/]+)(?:/([0-9]+))?/?$ => index.php?name=$matches[1]&page=$matches[2] blog/(.+?)/?$ => index.php?category_name=$matches[1] Rewrite rule position in the rewrite_rules_array Your post rewrite rule (#1) is positioned earlier (therefore higher priority) than the category rewrite rule (#2) in your rewrite_rules_array. … Read more
filter the custom post type using wp ajax request
I need help with filter products in custom teplate
It looks like you want to list products with post_type=product etc.. AND have the same ean code. Therefore, in your place i would try with the line ‘relation’ => ‘OR’ changed to ‘relation’ => ‘AND’ Regards,
Your query might be picking up sticky posts. To ignore them, try this: $args = array( ‘meta_query’ => array( array( ‘key’ => ‘featured_posts’, ‘compare’ => ‘==’, ‘value’ => ‘0’ ) ), ‘post_type’ => ‘post’, // Changed ‘3’ to 3, since WP_Query expects an int. ‘posts_per_page’ => 3, // Ignore the sticky posts. ‘ignore_sticky_posts’ => true, … Read more
I have a feeling there are multiple ways to accomplish what you want, but here is one option for consideration. Option 1 You should be able to achieve this by using the WP_Query class in WordPress. To query multiple post types and define the number of posts for each one, you can use the following … Read more