- This topic has 1 reply, 2 voices, and was last updated 6 years, 7 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › Issue with results
Tagged: results
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