If I look at a typical page, our form javascript etc is not loading. How have you incorporated the results.php I gave you to the site? Is the form setup as a Shortcode Display Results method, as described here:
https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/
I have a sample results.php for you, but as I can’t test it, I don’t know if it will work:
<?php
/* Blog Style A */
if ( $query->have_posts() ) {
?>
Found <?php echo $query->found_posts; ?> Results<br />
Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
<?php
while ($query->have_posts()) {
$query->the_post();
$cb_post_id = $post->ID;
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('cb-blog-style-a cb-module-e cb-separated clearfix'); ?>>
<div class="cb-mask cb-img-fw" <?php cb_img_bg_color( $cb_post_id ); ?>>
<?php cb_thumbnail( '260', '170' ); ?>
<?php cb_review_ext_box( $cb_post_id ); ?>
</div>
<div class="cb-meta clearfix">
<h2 class="cb-post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php cb_byline( $cb_post_id ); ?>
<div class="cb-excerpt"><?php echo cb_clean_excerpt( 160 ); ?></div>
<?php cb_post_meta( $cb_post_id ); ?>
</div>
</article>
<?php
}
cb_page_navi( $cb_qry );
}
wp_reset_postdata();
?>
Follow the instructions for the Shortcode Display result method:
https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/
And follow the customisation guide, but use that code instead of the content that is in the default results.php template file.
AnonymousInactive
I’m trying to create something similar to this layout:
http://www.artcenter.edu/about/get-to-know-artcenter/people/faculty.html?dept=ENT
Instead of by letter, it would be by department, which is a custom taxonomy called Department for a custom post type of Faculty.
How can I modify the results.php to break this out?
AnonymousInactive
Hello,
I’m using S&F 2.2.0
I’m using the Shortcode Method and I want to use the infinite scroll display result.
Problem : I only have one file in wp-content\plugins\search-filter\templates\
results.php
i dont have the infinite scroll results.php
My website
http://www.filmspourenfants.net/v2/
Thanks for your help 🙂
The ease by which you achieve the ‘look’ depends on the theme and Custom fields/taxonomies plugins you use.
How far did you follow the results.php customisation guide?
https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results
Then if you are using our results.php, you can use php to print out the values individually:
https://pods.io/docs/code/pods/field/
https://codex.wordpress.org/Function_Reference/the_terms
AnonymousInactive
Hi Trevor,
Love the plugin. I have created a page (using the new Thrive Architect) that simply has 2 columns and the relevant short code for the search form in the left column and the results in the right column. I have also created a custom results.php file
Everything works fine re results and filtering however the check boxes have a “styled” class on them when the page first loads and as soon as you select any of the filters in the form and the results reload. The check boxes in the form then loose the “styled” tag.
On Page Load:
<li class="sf-level-0 sf-item-36" data-sf-count="4" data-sf-depth="0">
<input value="masterclass" name="_sft_category[]" id="sf-input-c9d6c3225e54e2a88ba6865be80c549f" class="sf-input-checkbox styled" type="checkbox">
<label class="sf-label-checkbox" for="sf-input-c9d6c3225e54e2a88ba6865be80c549f">Masterclass<span class="sf-count">(4)</span></label>
</li>
After page results are filtered:
<li class="sf-level-0 sf-item-36" data-sf-count="4" data-sf-depth="0">
<input value="masterclass" name="_sft_category[]" id="sf-input-c9d6c3225e54e2a88ba6865be80c549f" class="sf-input-checkbox" type="checkbox">
<label class="sf-label-checkbox" for="sf-input-c9d6c3225e54e2a88ba6865be80c549f">Masterclass<span class="sf-count">(4)</span></label>
</li>
Please advise on a fix for this.
FYI. As yet I have not added our License key to the plugin on the settings page as it is on our staging server.
Kind Regards
Rick
AnonymousInactive
Thanks for the quick response! I should have mentioned that I’m using the shortcode method for this S&F implementation, so I don’t have an ajax container defined.
This is the entire results.php template in case that helps:
<?php
/**
* Search & Filter Pro
*
* Resource Results Template
*
*
*/
if ( $query->have_posts() ) {
$total_posts = $query->found_posts;
?>
<?php
$current_page = $query->query_vars['paged'];
$current_post_count = $query->post_count - 1;
$posts_per_page = $query->query_vars['posts_per_page'];
$total_posts = $query->found_posts;
$posts_start = ($current_page - 1 ) * $posts_per_page + 1;
if( $posts_per_page > $total_posts ) {
$posts_start = 1;
}
$posts_end = $posts_start + $current_post_count;
?>
<div class="search-filter-results-header">
<?php echo $posts_start . "-" . $posts_end . " of " . $total_posts . __(' Resources', 'visceral'); ?>
</div>
<div class="row resources-list">
<?php
while ($query->have_posts()) {
$query->the_post();
get_template_part('templates/list-item-resource');
}
?>
</div>
<?php // Pagination
$total = $query->max_num_pages;
// only bother with pagination if we have more than 1 page
if ( $total > 1 ) : ?>
<nav class="pagination text-center">
<?php
// Set up pagination to use later on
$big = 999999999; // need an unlikely integer
$pagination = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('sf_paged') ),
'total' => $total,
'type' => 'plain',
'prev_next' => true,
'prev_text' => __('', 'visceral'),
'next_text' => __('', 'visceral')
) );
echo $pagination; ?>
</nav>
<?php endif; ?>
<?php
}
else
{
echo "No Results Found";
}
?>
Thank you!
Curiously, our code IS the standard WP pagination. If you see numbers, it is added by the theme. In any event, you will have an Ajax container defined, and the pagination must be INSIDE that.
For the Shortcode display results method, Search & Filter adds its own container and knows to use that for Ajax.
Our standard results.php should refresh the pagination upon an Ajax refresh, with or without WP-PageNavi.