Search product by brand name in wp_query

Founded: $filter_group_a = array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘term_id’, ‘terms’ => 18, ), array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘term_id’, ‘terms’ => 25, ), ); $filter_group_b = array( array( ‘taxonomy’ => ‘product_brand’, ‘field’ => ‘description’, ‘value’ => $tmp, ), ); $args = array( ‘post_type’ => ‘product’, ‘s’ => $tmp, ‘posts_per_page’ … Read more

Retrieve or Query Pages by ID

This is an inappropriate use of query_posts() which is only for modifying the main query for the page. Additionally, even if you change your snippet to use get_posts(), your template tags (e.g. the_excerpt()) won’t work as get_posts() isn’t a method of looping through posts, it just returns an array of posts. What you want is … Read more

How to Loop within a Loop (Display Children and then Grandchildren)

Try something like: <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <div class=”parent-post”> <?php the_title(‘<h2>’, ‘</h2>’); ?> <?php $children = new WP_Query( array(‘post_type’ => ‘page’, ‘post_parent’ => get_the_ID() )); ?> <?php if ( $children->have_posts() ) : ?> <ul class=”post-children”> <?php while ( $children->have_posts() ) : $children->the_post(); ?> <li><?php … Read more