Forums Forums Search & Filter Pro Custom Template

Viewing 3 posts - 1 through 3 (of 3 total)
  • Anonymous
    #181547

    I tried to create a custom template by copying one of my per-existing templates and running through the WP loop. I looked at the documentation to verify that I was running the correct query. Unfortunately it just loads all of the posts without any filtering whatsoever. I just need more direction on how to make this work correctly.

    `<?php $args = array(‘post_type’ => ‘post’, ‘search_filter_id’ => 49); $search_results = new WP_Query( $args ); if ($search_results->have_posts()) : while ( $search_results->have_posts() ) : $search_results->the_post();?>
    <article class=”recent__post”>
    <div class=”recent__post-thumbnail” style=”background-image: url(‘<?php the_post_thumbnail_url( ‘medium_large’ ); ?>’)” ></div>
    <div class=”recent__post-info”>
    <div class=”recent__post-meta”>
    <?php print_formatted_topic( ‘recent__post-taxonomy’ ) ?>
    <time class=”recent__post-time”>/ <?php the_time(‘M jS, Y’); ?></time>
    </div>
    <h3 class=”recent__post-heading”>
    <a href=”<?php the_permalink(); ?>”>
    <?php the_title(); ?>
    </a>
    </h3>
    <p class=”recent__post-exerpt”>
    <?php echo get_the_excerpt(); ?>
    </p>
    </div>
    </article>
    <?php endwhile;?>
    <?php endif; wp_reset_postdata();?>`

    My primary objective is to have finely tuned markup in the results. I want the post result structure to match the markup above exactly. Thanks for any help you may be able to provide!

    Trevor
    #181556

    It might be easier to use our Shortcode Display results method, copy the results.php file as instructed to your child theme folder, find the bit in that code that matches your ‘while’ loop and replace our code with yours (not all of yours will be needed):

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/

    Anonymous
    #181574

    Awesome! Thank you!! For anyone else that may have run into the same issue I discovered that I didn’t ID my ajax container. After adding the ID to the search & filter config it replaced that container with results

Viewing 3 posts - 1 through 3 (of 3 total)