Can I use this plugin to filter a custom product loop?
-
Hi There,
I have a custom product loop on my archive.php. Is it possible to add and use this filter to filter products in that loop? If so how? Thanks.
Here is example of my archive.php product loop:
// Setup your custom query $loop = new WP_Query( array( 'post_type' => 'product', 'posts_per_page' => -1, 'post_status' => 'publish', 'tax_query' => array( array( 'taxonomy' => 'product_cat', // The taxonomy name 'field' => 'term_id', // Type of field ('term_id', 'slug', 'name' or 'term_taxonomy_id') 'terms' => $term->term_id, // can be an integer, a string or an array ) ), ) ); if ( $loop->have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post(); the_post_thumbnail( 'thumbnail'); echo '<div style="margin:25px;">'; $step1 = get_field ( "example1" ); $step2 = get_field('example3', 'user_'.$step1 ); $data = array( 'foo' => 'bar', 'baz' => 'boom', 'cow' => 'milk', 'php' => 'hypertext processor' ); $base_url = 'https://my-site.com/?page_id=1123/'; $query_params = http_build_query($data); $link = $base_url . '?' . $query_params; echo '<strong>'; echo '<a href = "' . $link . '">' .$step2. '</a>'; echo '</strong>'; echo '<br>'; $example2 = get_field ( "example2" ); echo '<a href="' .$destinationlink. '" target="_blank">'; the_title(); echo "</a>"; endwhile; wp_reset_postdata(); // Remember to reset endif; endif; ?>
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Can I use this plugin to filter a custom product loop?’ is closed to new replies.