Forums Forums Search & Filter Pro Issue with results

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Anonymous
    #217403

    Hello,

    I’m unable to get sf to work despite referencing the docs.

    `
    <?php get_header(); ?>

    <?= do_shortcode(‘[searchandfilter id=”6165″]’); ?>

    <?php
    $squery = new WP_Query([
    ‘search_filter_id’ => 6165
    ]);
    ?>

    <?php if ( $squery->have_posts() ) : ?>

    <section class=”c-section c-section–alt c-section–pad”>

    <div class=”c-section__title”>Results</div>

    <div class=”c-tracks”>

    <?php while ( $squery->have_posts() ) : $squery->the_post(); ?>

    <?php

    $variation = wc_product_first_variation( get_the_ID() );
    $sample_url = $variation->get_meta( ‘_sample_track’ );

    $product = wc_get_product( get_the_ID() );
    $count = count( $product->get_children() );
    ?>

    <?= view(‘components.track’, [
    ‘variation’ => $variation,
    ‘sample_url’ => $sample_url,
    ‘product’ => $product,
    ‘count’ => $count
    ]); ?>

    <?php endwhile; ?>

    </div>

    </section>

    <?php endif; ?>

    <?php get_footer(); ?>
    `

    I have this code in my search.php and the form works as you’d expect but the results are just a list of products, completely unrelated to the query. Where have I gone wrong?

    All the best,
    Matt

    Trevor
    #217499
    This reply has been marked as private.
Viewing 2 posts - 1 through 2 (of 2 total)