-
AuthorSearch Results
-
December 23, 2020 at 10:11 am #270904
In reply to: suit #270629 Ticket not found…
TrevorParticipantThis is the standard results.php template file:
<?php /** * Search & Filter Pro * * Sample Results Template * * @package Search_Filter * @author Ross Morsali * @link https://searchandfilter.com * @copyright 2018 Search & Filter * * Note: these templates are not full page templates, rather * just an encaspulation of the your results loop which should * be inserted in to other pages by using a shortcode - think * of it as a template part * * This template is an absolute base example showing you what * you can do, for more customisation see the WordPress docs * and using template tags - * * http://codex.wordpress.org/Template_Tags * */ // If this file is called directly, abort. if ( ! defined( 'ABSPATH' ) ) { exit; } 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 /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <?php while ($query->have_posts()) { $query->the_post(); ?> <div> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <p><br /><?php the_excerpt(); ?></p> <?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("small"); echo '</p>'; } ?> <p><?php the_category(); ?></p> <p><?php the_tags(); ?></p> <p><small><?php the_date(); ?></small></p> </div> <hr /> <?php } ?> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <?php } else { echo "No Results Found"; } ?>
The strings you want to translate are like this:
Found <?php echo $query->found_posts; ?> Results<br /> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
In the file I showed above, these are on lines 34/35.
Then on line 78 is this:
Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
Are those the lines you need?
November 30, 2020 at 4:33 pm #268258In reply to: Not keep same design as my post after request
TrevorParticipantYou are using our shortcode method, so some background is important for me to explain. Our plugin files are located on your server in this location:
…/wp-content/plugins/search-filter-pro
There you will find a sub-folder named
templates
and in that a file namedresults.php
.This documentation:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
tells the user to copy that file to their child theme folder, and place it in to a sub-folder that they should name
search-filter
Note that it is always good practice to use a child theme (this is a WordPress recommendation), as it stops updates of a theme from overwriting or deleting any changes and customizations).
Similarly, if you fail to make that copy of the result.php template file and make your edits to that, then, when our plugin updates, it will overwrite the results.php file in our plugin templates folder.
Then, you edit that results.php file to make the template for the page.
The file, I think, needs this content:
<?php /** * Search & Filter Pro * * Sample Results Template * * @package Search_Filter * @author Ross Morsali * @link https://searchandfilter.com * @copyright 2018 Search & Filter * * Note: these templates are not full page templates, rather * just an encaspulation of the your results loop which should * be inserted in to other pages by using a shortcode - think * of it as a template part * * This template is an absolute base example showing you what * you can do, for more customisation see the WordPress docs * and using template tags - * * http://codex.wordpress.org/Template_Tags * */ // If this file is called directly, abort. if ( ! defined( 'ABSPATH' ) ) { exit; } 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 /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <?php while ($query->have_posts()) { $query->the_post(); if(class_exists('WPBMap') && method_exists('WPBMap', 'addAllMappedShortcodes')) { WPBMap::addAllMappedShortcodes(); } ?> <div><?php echo get_the_content(); ?></div> <?php } ?> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <?php } else { echo "No Results Found"; } ?>
This assumes that post post content of these results is as you show in those rows at the bottom of the page, as my method will show all the content of those posts.
November 18, 2020 at 3:53 pm #266974
TrevorParticipantIf you are using our Shortcode method, this is an alternate Infinite Scroll results.php file:
<?php /** * Search & Filter Pro * * Sample Results Template * * @package Search_Filter * @author Ross Morsali * @link http://www.designsandcode.com/ * @copyright 2015 Designs & Code * * Note: these templates are not full page templates, rather * just an encaspulation of the your results loop which should * be inserted in to other pages by using a shortcode - think * of it as a template part * * This template is an absolute base example showing you what * you can do, for more customisation see the WordPress docs * and using template tags - * * http://codex.wordpress.org/Template_Tags * */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( $query->have_posts() ) { ?> Found <?php echo $query->found_posts; ?> Results<br /> <div class='search-filter-results-list'> <?php while ($query->have_posts()) { $query->the_post(); ?> <div class='search-filter-result-item'> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <p><br /><?php the_excerpt(); ?></p> <?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("small"); echo '</p>'; } ?> <p><?php the_category(); ?></p> <p><?php the_tags(); ?></p> <p><small><?php the_date(); ?></small></p> <hr /> </div> <?php } ?> </div> <?php } else { //figure out which type of "no results" message to show $message = "noresults"; if(isset($query->query['paged'])) { if($query->query['paged']>1){ $message = "endofresults"; } } if($message=="noresults") { ?> <div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'> <span>No Results Found</span> </div> <?php } else { ?> <div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'> <span>End of Results</span> </div> <?php } } ?>
November 11, 2020 at 5:15 pm #266107In reply to: Infinite scroll is loading too many pages at once.
TrevorParticipantHere is my version of that code, with new lines 30 and 58:
<?php /** * Search & Filter Pro * * Sample Results Template * * @package Search_Filter * @author Ross Morsali * @link https://searchandfilter.com * @copyright 2018 Search & Filter * * Note: these templates are not full page templates, rather * just an encaspulation of the your results loop which should * be inserted in to other pages by using a shortcode - think * of it as a template part * * This template is an absolute base example showing you what * you can do, for more customisation see the WordPress docs * and using template tags - * * http://codex.wordpress.org/Template_Tags * */ if ( $query->have_posts() ) { ?> <div class="results-head clear"> <h1><?php _e('Nieuws & Blog artikelen','best4u');?></h1> </div> <div class='search-filter-results-list'> <?php while ( $query->have_posts() ) : $query->the_post(); // $query->the_post(); $id = get_post()->ID; $image = get_the_post_thumbnail_url( $id, 'medium_large' ); $title = get_the_title( $id ); $permalink = get_the_permalink( $id ); ?> <div class="item span-4"> <?php if ( $image ): ?> <div class="latest-news__thumb object-fit sz-16-9"> <a href="<?php echo $permalink; ?>" ><img class="lazy-img lazy" data-src="<?php echo $image; ?>" src="<?php echo get_template_directory_uri() ?>/placeholder.png" alt="<?php echo $title ?>"></a> </div> <?php endif; ?> <div class="latest-news__cnt"> <h3><a href="<?php echo $permalink; ?>"><?php echo $title; ?></a></h3> <div class="content"> <?php echo my_content( 20, false, false ); ?> </div> <div class="link"> <a href="<?php echo $permalink; ?>" class="read-more"><?php _e( 'Lees meer', 'best4u' ); ?></a> </div> </div> </div> <?php endwhile; ?> </div> <?php if ( function_exists( 'wp_pagenavi' ) ) { ?> <div class="pagination"> <?php wp_pagenavi( array( 'query' => $query ) ); ?> </div> <?php } ?> <?php } else {?> <h3><?php _e('Geen resultaten gevonden','best4u')?></h3> <?php } ?>
October 13, 2020 at 4:19 pm #262848In reply to: No results mesagge on infinite scroll
TrevorParticipantYou could use this alternative results.php template:
<?php /** * Search & Filter Pro * * Sample Results Template * * @package Search_Filter * @author Ross Morsali * @link http://www.designsandcode.com/ * @copyright 2015 Designs & Code * * Note: these templates are not full page templates, rather * just an encaspulation of the your results loop which should * be inserted in to other pages by using a shortcode - think * of it as a template part * * This template is an absolute base example showing you what * you can do, for more customisation see the WordPress docs * and using template tags - * * http://codex.wordpress.org/Template_Tags * */ if ( ! defined( 'ABSPATH' ) ) { exit; } if ( $query->have_posts() ) { ?> Found <?php echo $query->found_posts; ?> Results<br /> <div class='search-filter-results-list'> <?php while ($query->have_posts()) { $query->the_post(); ?> <div class='search-filter-result-item'> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <p><br /><?php the_excerpt(); ?></p> <?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("small"); echo '</p>'; } ?> <p><?php the_category(); ?></p> <p><?php the_tags(); ?></p> <p><small><?php the_date(); ?></small></p> <hr /> </div> <?php } ?> </div> <?php } else { //figure out which type of "no results" message to show $message = "noresults"; if(isset($query->query['paged'])) { if($query->query['paged']>1){ $message = "endofresults"; } } if($message=="noresults") { ?> <div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'> <span>No Results Found</span> </div> <?php } else { ?> <div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'> <span>End of Results</span> </div> <?php } } ?>
September 24, 2020 at 6:10 am #260600In reply to: Multiple filters on a page pagination problem
AnonymousInactiveeach filter template is pretty much the same
<?php /** * Search & Filter Pro * * Sample Results Filter News * * @package Search_Filter * @author Ross Morsali * @link https://searchandfilter.com * @copyright 2018 Search & Filter * * Note: these templates are not full page templates, rather * just an encaspulation of the your results loop which should * be inserted in to other pages by using a shortcode - think * of it as a template part * * This template is an absolute base example showing you what * you can do, for more customisation see the WordPress docs * and using template tags - * * http://codex.wordpress.org/Template_Tags * */ // If this file is called directly, abort. if ( ! defined( 'ABSPATH' ) ) { exit; } ?> <div id="site_post_feed"> <?php if ( $query->have_posts() ) { ?> <?php while ($query->have_posts()) { $query->the_post(); ?> <div id="site_post_feed_item"> <div id="site_post_feed_item_featured_image"> <a href="<?php echo get_the_permalink();?>"><?php echo get_the_post_thumbnail(); ?></a> </div> <div id="site_post_feed_item_item_title"> <a href="<?php echo get_the_permalink();?>"> <?php echo get_the_title() ?></a></div> <div id="site_post_feed_item_item_excerpt"><a href="<?php the_permalink() ?>"> <?php echo wp_trim_words( get_the_excerpt(), 20, $moreLink = null)?> </a></div> <div id="site_post_feed_item_item_category"> <?php echo wpdocs_custom_taxonomies_terms_links(); ?> </div> <div id="site_post_feed_item_date"> <a href="'<?php the_permalink() ?>"><?php echo get_the_date() ?></a> </div> </div> <?php } ?> <?php } else { // echo "No Results Found"; } ?> </div> <div class="pagination"> <div class="pagination" id="site_pagination"></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div>
September 23, 2020 at 5:22 pm #260508In reply to: duplicate results
AnonymousInactiveThanks so much!! I’m trying the code tick thing here, but here’s a link to the file, too, just in case: https://www.dropbox.com/s/lq01m81d0zc5qnt/results.php?dl=0 — Thanks again for the prompt reply and support!
<?php /** * Search & Filter Pro * * Sample Results Template * * @package Search_Filter * @author Ross Morsali * @link https://searchandfilter.com * @copyright 2018 Search & Filter * * Note: these templates are not full page templates, rather * just an encaspulation of the your results loop which should * be inserted in to other pages by using a shortcode - think * of it as a template part * * This template is an absolute base example showing you what * you can do, for more customisation see the WordPress docs * and using template tags - * * http://codex.wordpress.org/Template_Tags * */ 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 /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <?php while ($query->have_posts()) { $query->the_post(); ?> <div> <p><?php the_content(); ?><p> </div> <hr /> <?php } ?> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <?php } else { echo "No Results Found"; } ?>
September 23, 2020 at 8:36 am #260430In reply to: Multiple filters on a page pagination problem
AnonymousInactive`<?php
/**
* Search & Filter Pro
*
* Sample Results Filter News
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*
* Note: these templates are not full page templates, rather
* just an encaspulation of the your results loop which should
* be inserted in to other pages by using a shortcode – think
* of it as a template part
*
* This template is an absolute base example showing you what
* you can do, for more customisation see the WordPress docs
* and using template tags –
*
* http://codex.wordpress.org/Template_Tags
*
*/// If this file is called directly, abort.
if ( ! defined( ‘ABSPATH’ ) ) {
exit;}
?>
<div id=”site_post_feed”>
<?phpif ( $query->have_posts() )
{
?><?php
while ($query->have_posts())
{
$query->the_post();?>
<div id=”site_post_feed_item”>
<div id=”site_post_feed_item_featured_image”>
<a href=”<?php echo get_the_permalink();?>”><?php echo get_the_post_thumbnail(); ?></a>
</div>
<div id=”site_post_feed_item_item_title”>
<a href=”<?php echo get_the_permalink();?>”>
<?php echo get_the_title() ?></a></div>
<div id=”site_post_feed_item_item_excerpt”><a href=”<?php the_permalink() ?>”>
<?php echo wp_trim_words( get_the_excerpt(), 20, $moreLink = null)?>
</a></div>
<div id=”site_post_feed_item_item_category”><?php echo wpdocs_custom_taxonomies_terms_links(); ?>
</div>
<div id=”site_post_feed_item_date”>
<a href=”‘<?php the_permalink() ?>”><?php echo get_the_date() ?></a>
</div>
</div><?php
}?>
<?php
}
else
{
// echo “No Results Found”;
}
?></div>
<div class=”pagination”>
<div class=”pagination” id=”site_pagination”></div><?php
/* example code for using the wp_pagenavi plugin */
if (function_exists(‘wp_pagenavi’))
{
echo “<br />”;
wp_pagenavi( array( ‘query’ => $query ) );
}
?></div>
September 21, 2020 at 2:04 pm #260159In reply to: Results showing up twice
AnonymousInactiveI’ve updated so more in line with original
<?php
/**
* Search & Filter Pro
*
* Sample Results Template
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*
* Note: these templates are not full page templates, rather
* just an encaspulation of the your results loop which should
* be inserted in to other pages by using a shortcode – think
* of it as a template part
*
* This template is an absolute base example showing you what
* you can do, for more customisation see the WordPress docs
* and using template tags –
*
* http://codex.wordpress.org/Template_Tags
*
*/// If this file is called directly, abort.
if ( ! defined( ‘ABSPATH’ ) ) {
exit;
}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 /><div class=”pagination”>
<div class=”nav-previous”><?php next_posts_link( ‘Older posts’, $query->max_num_pages ); ?></div>
<div class=”nav-next”><?php previous_posts_link( ‘Newer posts’ ); ?></div>
<?php
/* example code for using the wp_pagenavi plugin */
if (function_exists(‘wp_pagenavi’))
{
echo “<br />”;
wp_pagenavi( array( ‘query’ => $query ) );
}
?>
</div><?php
while ($query->have_posts())
{
$query->the_post();?>
<div>
<?php get_template_part(‘template-parts/content’, get_post_type()); ?></div>
<?php
}
?>
Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br /><div class=”pagination”>
<div class=”nav-previous”><?php next_posts_link( ‘Older posts’, $query->max_num_pages ); ?></div>
<div class=”nav-next”><?php previous_posts_link( ‘Newer posts’ ); ?></div>
<?php
/* example code for using the wp_pagenavi plugin */
if (function_exists(‘wp_pagenavi’))
{
echo “<br />”;
wp_pagenavi( array( ‘query’ => $query ) );
}
?>
</div>
<?php
}
else
{
echo “No Results Found”;
}
?>September 21, 2020 at 1:59 pm #260158In reply to: Results showing up twice
AnonymousInactiveThis is the code I’ve given in the results display
<?php
/**
* Search & Filter Pro
*
* Sample Results Template
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*
* Note: these templates are not full page templates, rather
* just an encaspulation of the your results loop which should
* be inserted in to other pages by using a shortcode – think
* of it as a template part
*
* This template is an absolute base example showing you what
* you can do, for more customisation see the WordPress docs
* and using template tags –
*
* http://codex.wordpress.org/Template_Tags
*
*/// If this file is called directly, abort.
if ( ! defined( ‘ABSPATH’ ) ) {
exit;
}if ( $query->have_posts() )
{while ($query->have_posts())
{
$query->the_post();?>
<div>
<?php get_template_part(‘template-parts/content’, get_post_type()); ?></div>
<!– <hr /> –>
<?php
}
?>
Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br /><div class=”pagination”>
<?php
}
else
{
echo “No Results Found”;
}
?> -
AuthorSearch Results