-
AuthorSearch Results
-
November 13, 2017 at 6:41 pm #141690
In reply to: Infinite Scroll not working
TrevorParticipantHi
I am sorry that I have not been able to take a look at this thread this afternoon, because we had a power outage this afternoon.
Reading your last post, I took a quick look at the page source code and I can see the other form.
But, on the page that works, that also has two forms, so I am not certain this is the issue.
I think it may be the structure of the page, but why should work and the other not, I am not sure.
Our default infinite scroll template has the post container set to
.search-filter-results-listand the individual post container set to.search-filter-result-itemIf I look at your code (for the broken page), it does not have an Ajax Container and has
.worterbuchas the Post Container.Maybe it should look more like this:
<?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 ( $query->have_posts() ) { ?> <div class='search-filter-results-list'> <?php while ($query->have_posts()) { $query->the_post(); ?> <table class="worterbuch search-filter-result-item"> <tbody> <tr> <td colspan="2" class="ueberschrift"><?php the_title(); ?></td> </tr> <tr> <td width="5%" class="sprache">HE</td> <td width="95%" class="inhalt-he"><?php the_content(); ?> </td> </tr> <tr> <td width="5%" class="sprache">EN</td> <td width="95%" class="inhalt"><?php the_excerpt(); ?></td> </tr> </tbody> </table> <?php } ?> </div> <?php } else { echo "Keine weiteren Suchergebnisse"; } ?>November 13, 2017 at 1:07 pm #141612In reply to: Infinite Scroll not working
AnonymousInactive… here we have a different page where the infinite scroll works perfect:
<?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 ( $query->have_posts() )
{
?><?php
while ($query->have_posts())
{
$query->the_post();?>
<table class=”worterbuch-he”>
<tbody>
<tr>
<td colspan=”2″ class=”ueberschrift”><?php the_title(); ?></td>
</tr>
<tr>
<td width=”5%” class=”sprache”>EN</td>
<td width=”95%” class=”inhalt-ivr”><?php the_content(); ?> </td>
</tr>
<tr>
<td width=”5%” class=”sprache”>DE</td>
<td width=”95%” class=”inhalt-ivr”><?php the_excerpt(); ?></td>
</tr>
</tbody>
</table>
<?php
}
?><?php
}
else
{
echo “אין תוצאות נוספות”;
}
?>
November 13, 2017 at 1:04 pm #141610In reply to: Infinite Scroll not working
AnonymousInactiveHi, thanks for the quick answer,
<?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 ( $query->have_posts() ) { ?> <?php while ($query->have_posts()) { $query->the_post(); ?> <table class="worterbuch"> <tbody> <tr> <td colspan="2" class="ueberschrift"><?php the_title(); ?></td> </tr> <tr> <td width="5%" class="sprache">HE</td> <td width="95%" class="inhalt-he"><?php the_content(); ?> </td> </tr> <tr> <td width="5%" class="sprache">EN</td> <td width="95%" class="inhalt"><?php the_excerpt(); ?></td> </tr> </tbody> </table> <?php } ?> <?php } else { echo "Keine weiteren Suchergebnisse"; } ?>October 23, 2017 at 8:36 pm #138032In reply to: Tags to include
AnonymousInactiveHi Trevor!
I only have 6 pieces of test content that I am filtering on, so I doubt I’m maxing anything out. I’m working on this locally, so I’m not sure if the littlebizzy plugin is going to give you anything useful, but let me know if I should do that anyway.
One thing I suspect it might be: I am using the shortcode method to display results, using a customized results.php template. Do I need to update that results template code to implement the tag filtering? (If so, do you happen to have any sample code that might help me get started?) The search filters at the top seem to be filtering properly for the tag that I chose, which corroborates my suspicion.
thank you so much!
September 12, 2017 at 11:09 pm #130732In reply to: Removing "Array" value from results page.
AnonymousInactiveHi Trevor,
Here is the full php file for the custom results page.
<?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 ( $query->have_posts() ) { ?> <div class="resultnumber"> Found <?php echo $query->found_posts; ?> Results<br /> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> </div> <div class="results schoolheadings"> <div class="cell heading schoolname">School</div> <div class="cell heading">Full-Time Resident</div> <div class="cell heading">Full-Time Non-Resident</div> <div class="cell heading">Part-Time Resident</div> <div class="cell heading">Part-Time Non-Resident</div> <div class="cell heading"></div> </div> <?php while ($query->have_posts()) { $query->the_post(); ?> <div class="results"> <div class="cell schoolname"> <h5><span class="showonmobile title">School: </span><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5> </div> <div class="cell"><span class="showonmobile title">Full-Time Resident: $</span> <?php $full_time_resident = get_post_meta(get_the_id(),'full-time_resident_tuition', true); echo $full_time_resident ; ?> </div> <div class="cell"><span class="showonmobile title">Full-Time Non-Resident: $</span> <?php $full_time_non_resident = get_post_meta(get_the_id(),'full-time_non-resident_tuition', true); echo $full_time_non_resident; ?> </div> <div class="cell"><span class="showonmobile title">Part-Time Resident: $</span> <?php $part_time_resident = get_post_meta(get_the_id(),'part-time_resident_tuition', true); echo $part_time_resident; ?> </div> <div class="cell"><span class="showonmobile title">Part-Time Non-Resident: $</span> <?php $part_time_non_resident = get_post_meta(get_the_id(),'part-time_non-resident_tuition', true); echo $part_time_non_resident; ?> </div> <div class="cell"> <a class="button" href="<?php the_permalink(); ?>">Learn More</a> </div> </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"; } ?>The code below is also included above and is what pushed data live to the results page
<div class="cell"><span class="showonmobile title">Full-Time Resident: $</span> <?php $full_time_resident = get_post_meta(get_the_id(),'full-time_resident_tuition', true); echo $full_time_resident ; ?> </div>
TrevorParticipantThis is the customised results.php to work in your child theme of the Primrose theme, making it look like the grid you made with SiteOrigin:
<?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 ( $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> <div id="sf-custom-results" class="panel-layout"> <?php $result_counter=0; $data_index=0; while ($query->have_posts()) { $query->the_post(); ?> <div class="sf-results-row panel-grid panel-no-style"> <div class="sf-results-leftcol panel-grid-cell"> <div class="so-panel widget widget_sow-image panel-first-child panel-last-child" data-index="<?php echo $data_index++;?>"> <div class="so-widget-sow-image so-widget-sow-image-default-eef982a7180b"> <div class="sow-image-container"> <?php if ( has_post_thumbnail() ) { the_post_thumbnail("full"); } ?> </div> </div> </div> </div> <div class="sf-results-rightcol panel-grid-cell"> <div class="so-panel widget widget_sow-editor panel-first-child panel-last-child" data-index="<?php echo $data_index++;?>"> <div class="so-widget-sow-editor so-widget-sow-editor-base"> <h3 class="widget-title"><?php the_title(); ?></h3> <div class="siteorigin-widget-tinymce textwidget"> <header class="w2dc-listing-header"><p>blah</p></header> <p><br /><?php the_excerpt(); ?></p> </div> </div> </div> </div> </div> <?php //$result_counter++; } ?> </div> <div>Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?></div> <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 is the Custom CSS that accompanies it:
.sf-results-leftcol.panel-grid-cell { width: 25% !important; width: calc(25% - ( 0.750000001875 * 40px)) !important; } .sf-results-rightcol.panel-grid-cell { width: 75% !important; width: calc(75% - ( 0.249999998125 * 40px)) !important; } #sf-custom-results .so-panel { margin-bottom: 0; } #sf-custom-results div.sf-results-row:nth-last-child(2) { margin-bottom: 0; } #sf-custom-results .sf-results-row { -webkit-align-items: flex-start; align-items: flex-start; margin-bottom: 40px; } @media (max-width: 767px) { .sf-results-leftcol.panel-grid-cell, .sf-results-rightcol.panel-grid-cell { width: 100% !important; } .sf-results-row { -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; } .sf-results-row .sow-image-container { text-align: center; } }July 1, 2017 at 10:32 am #118140In reply to: Visual Results?
TrevorParticipantBTW, this is the grid making results.php I used for your genesis theme:
<?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 ( $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 $odd_check = 1; $first_check = 1; while ($query->have_posts()) { $query->the_post(); if ( $odd_check == 1 ) { $odd_class = " odd"; } else { $odd_class = ""; } if ( $first_check == 1 ) { $first_class = " first"; } else { $first_class = ""; } ?> <article class="simple-grid one-third<?php echo $odd_class;?><?php echo $first_class;?> post-<?php echo get_the_ID();?> post type-post status-publish format-standard entry"> <a href="<?php the_permalink(); ?>" class="alignnone"> <?php the_post_thumbnail("small");?> </a> <header class="entry-header"> <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> </header> </article> <?php $odd_check++; if ( $odd_check == 3 ) $odd_check = 1; $first_check++; if ( $first_check == 4 ) $first_check = 1; } ?> <div style="clear: both;"> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?> </div> <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"; } ?>June 22, 2017 at 3:53 pm #116372In reply to: Pagination in Custom Display results method
TrevorParticipantHi
As you are making your own template, you need to refer to the WordPress Codex for making pagination. In our plugin folder, you will find a folder called templates and in that is a sample results.php template, which shows fairly standard pagination code. A plugin called WP-PageNavi is also a really good example of how to code it.
June 12, 2017 at 10:06 am #114400In reply to: No results, no message appears
AnonymousInactiveHi,
Here is the results.php, but I have another for costumization.RESULTS.PHP
<?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 ( $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 style="display: inline-block; width:50%;"> <?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("small"); echo '</p>'; } ?> </div> <div style="display: inline-block; width:50%;"> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <p> <?php the_category(); ?> </p> <p> <?php the_tags(); ?> </p> <p> <small> <?php the_date(); ?> </small> </p> <p><br/> <?php the_excerpt(); ?> </p> </div> < /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"; } ?>2553.PHP
<?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 ( $query->have_posts() ) { ?> <div style="float: left;"> <strong> <?php echo $query->found_posts; ?> </strong> resultado(s)</div> <div style="float: right;">Pág. <?php echo $query->query['paged']; ?> de <?php echo $query->max_num_pages; ?> </div> <div style="clear: both;"></div> <hr> <div class="pagination" style="width: 100% !important;"> <div style="float: right;"> <?php next_posts_link( '<span class="ion-arrow-right-c"></span>', $query->max_num_pages ); ?> </div> <div style="float: left;"> <?php previous_posts_link( '<span class="ion-arrow-left-c"></span>' ); ?> </div> <div style="clear: both;"></div> <?php /* example code for using the wp_pagenavi plugin */ if ( function_exists( 'wp_pagenavi' ) ) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <div style="clear: both;"></div> < ? php while ( $query->have_posts() ) { $query->the_post(); ?> <div style="float: left; width: 50%; padding-bottom: 50px;"> <?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("small"); echo '</p>'; } ?> </div> <div style="float: left; width: 50%; padding-left: 20px; padding-bottom: 50px;"> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <p> <?php echo do_shortcode('[pods field="resumo_objectivos"]'); ?> </p> <p> <?php echo do_shortcode('[pods field="datas"]'); ?> </p> <p> <?php echo do_shortcode('[pods field="preco"]'); ?> </p> <p> <?php echo do_shortcode('[pods field="duracao"]'); ?> </p> </div> <hr/> <div style="clear: both;"></div> < ? php } ?> <div class="pagination" style="width: 100% !important;"> <div style="float: right;"> <?php next_posts_link( '<span class="ion-arrow-right-c"></span>', $query->max_num_pages ); ?> </div> <div style="float: left;"> <?php previous_posts_link( '<span class="ion-arrow-left-c"></span>' ); ?> </div> <div style="clear: both;"></div> <?php /* example code for using the wp_pagenavi plugin */ if ( function_exists( 'wp_pagenavi' ) ) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <div style="clear: both;"></div> < ? php } else { echo "Não foram encontrados resultados"; } ?>May 12, 2017 at 4:37 pm #108542In reply to: Pagination not working properly
RossKeymasterHi Alex
Ok so I took a look, I see what you mean.
The issue usually is the way pagination works (and how it detects the current page).
S&F uses its own URL var (sf_paged) for pagination, so sometimes this causes issues like this.
I’m not familiar with beaver builder yet, but is there a way to customise pagination, using something like templates in your child theme? If you could figure that out, I know the code changes we would need to make 🙂
—
To explain the issue & solution anyway (it might be useful to beaverbuilder):
Take page 6 of results here – https://yourdevsite/maths-videos/?sf_paged=6
Its clear on your site, the pagination thinks its still on page 1 while S&F has paginated the results to page 6. This is all to do with how your theme (and many others) gets the
current pagevariable from WordPress, which is then passed on to the pagination function.A lot themes pagination will look something like:
$current_page = max(1, get_query_var('paged')); echo paginate_links(array( 'base' => get_pagenum_link(1) . '%_%', 'format' => 'page/%#%', 'current' => $current_page, 'total' => $total_pages, ));Notice, current page is set from this var –
get_query_var('paged').To make pagination work correctly in all scenarios, even when the page has been changed dynamically (this could be changed by
pre_get_postsfor example), I personally think its best to get the paged var from the query itself, circumventing the need to know the pagination variable name in the URL or if its been altered dynamically.My solution is to set current page using
$wp_query->query_vars['paged']– so the code sample above would useglobal $wp_query; $current_page = max(1, $wp_query->query_vars['paged']); echo paginate_links(array( 'base' => get_pagenum_link(1) . '%_%', 'format' => 'page/%#%', 'current' => $current_page, 'total' => $total_pages, ));This I think is a more compatible approach to handling pagination in general and allows for more options as a developer (and in this case, would allow your theme pagination to work with S&F custom pagination query var).
Anyway, hope that makes sense, if not, figuring out how to customise beaver builder pagination will be all I need to advise next steps 🙂
Best
-
AuthorSearch Results