Hi there,
I can get things working if I use the shortcode approach, utilising SAF’s own templates. However, I need to filter results displaying on the archive page, there is a basically an ACF checkbox ‘Show on the A-Z page’ (show_in_a_z_list), so I basically need to try and get SAF working with my custom archive page, unless I can make use of ACF on SAF’s template file?
Here is the code in my template, the SAF’s filters display, I just can get the AJAX side of things working, appreciate any help…
<?php
$posts = get_posts(array(
'numberposts' => -1,
'post_type' => 'brands',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'show_in_a_z_list',
'value' => '1',
'compare' => '=',
),
),
));
if( $posts ): ?>
<?php echo do_shortcode( '[searchandfilter id="1132"]' ); ?>
<?php echo do_shortcode( '[searchandfilter id="1132" show="results"]' ); ?>
<section class="blocks">
<?php $i = 1; ?>
<?php foreach( $posts as $post ):
setup_postdata( $post );
?>
<div class="block-<?php echo $i++; ?>">
<a href="<?php the_permalink(); ?>">
<article>
<?php $image = get_field( 'image' ); ?>
<?php if ( $image ) { ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php } ?>
</article>
</a>
</div>
<?php endforeach; ?>
</section>
<?php wp_reset_postdata(); ?>
<?php endif; ?>