• Resolved Em

    (@malmomen)


    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)
  • Hi,

    I’ve simulated it at my end with a few changes and it is working. Just you should consider you need to put some containers with a specific CSS class. Products must be wrap in <ul class="wpf-search-container products"></ul>. Also, each product must wrap in <li class="product"></li>.

    Please let us know if you have any questions.
    Kind regards,
    Mahmood

    Thread Starter Em

    (@malmomen)

    @hibitco Thanks for your reply. Can you show me how you got it to work on your end but with my loop?

    • This reply was modified 4 years, 7 months ago by Em.
    • This reply was modified 4 years, 7 months ago by Em.

    Actually I just wanted to make sure our plugin works with a custom loop or not. So I print some products with a custom loop on a page. Then drop the product filter on the sidebar and tested it with it.

    Thread Starter Em

    (@malmomen)

    @hibitco Okay I see, so it works out of the box for you with just your custom loop. I am trying to set up the horizontal filter so I can test out if this works for me too. Will be in touch if not. Thanks ~

    • This reply was modified 4 years, 7 months ago by Em.
    • This reply was modified 4 years, 7 months ago by Em.
    • This reply was modified 4 years, 7 months ago by Em.

    I need to access your website to debug it. But please consider it is against WP forum policy to share credentials.

    Thread Starter Em

    (@malmomen)

    @hibitco

    Okay thanks, I got the filter where I want it but it’s not filtering products in the loop for me.

    Do you guys have email I can send your credentials to so i don’t have to send over forum? [email protected]?

    You can contact us with [email protected]. Please don’t forgot to include this thread URL for our reference.

    Kind regards,
    Mahmood

    Thread Starter Em

    (@malmomen)

    @hibitco Okay Thank you will do

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.