-
AuthorSearch Results
-
November 16, 2016 at 9:23 pm #70771
In reply to: wp_pagenavi for Yoast breadcrumb
RossKeymasterHey Rai sorry for the delay.
If you take a look at the code from our results.php:
wp_pagenavi( array( 'query' => $query ) );You see we are passing in the query, this is necessary so wp_pagenavi knows that it working with a specific query rather than the global $WP_Query.
I had a quick look at the plugin you were using
wp_bootstrap_pagination–I see it is possible to pass a
custom_queryargument to it.. something like:$args = ( 'custom_query' => $query ); wp_bootstrap_pagination($args);I’m hoping this will work, however I’m not too familiar with that plugin, it might be best to ask them how to use their plugin with a custom query…
I do see one potential point of problem though, and that is this line (26):
$page = intval( get_query_var( 'paged' ) );That plugin is setting the current page variable with
get_query_varwhich uses the global query, which in this case will cause errors.EDIT: In fact I’ve just submitted an issue over there recommended the code change:
https://github.com/talentedaamer/Bootstrap-wordpress-pagination/issues/10Hope that helps!
November 16, 2016 at 8:43 pm #70756In reply to: Sort Results by star rating
AnonymousInactiveThanks for all the help Trevor, sorry to come back to you so quick but the code added in the results.php has just come up with ‘Array’ rather than the star rating?
while ($query->have_posts())
{
$query->the_post();?>
<div>
<h2>“><?php the_title(); ?></h2><p><br /><?php the_excerpt(); ?></p>
<?php
if ( has_post_thumbnail() ) {
echo ‘<p>’;
the_post_thumbnail(“small”);
echo ‘</p>’;
}
?>
<p><?php echo get_post_meta( get_the_ID(), ‘ratings_average’ ); ?></p>
<p></p>
<p><small></small></p></div>
<hr />
<?phpNovember 16, 2016 at 5:14 pm #70656In reply to: Customisation of the search results page
TrevorParticipantIn this post, I asked if you had followed the customization guide?
If you did, then the active copy of the results.php file is in your theme folder, not in our plugin folder.
November 16, 2016 at 12:06 pm #70490In reply to: Using buttons for search criteria
TrevorParticipantThe HTML element that the results are wrapped in depends on the Display results method chosen. If using our Shortcode method, you can edit the example results.php file (see here for how), but my default it has a containing tag like this (depending on the form ID):
<div class="search-filter-results" id="search-filter-results-255">I have re-read the thread. I need to get a better handle on what you want to do and what the page would look like. Have you sketched out the idea in visual form? Maybe you could upload an image to a file sharing site and give me a link?
November 15, 2016 at 11:13 am #70334In reply to: Customisation of the search results page
TrevorParticipantOK. The >> is made by your theme and needs to be switched off inside search and filter forms, with Custom CSS:
.bSe .searchandfilter ul li::before {content: '' !important;}To put the search field and button next to each other, this:
.searchandfilter .sf-field-search { display: inline-block; padding-left: 0 !important; margin-right: 20px; } .searchandfilter .sf-field-submit { display: inline-block; padding-left: 0 !important; }For the second point, to hide results until a search has been made, I need to know you have placed a copy of the results.php file in your theme or child theme folder, as here:
Assuming that you have, edit that file and replace the content with 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 * */ global $searchandfilter; $sf_current_query = $searchandfilter->get(255)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { echo '<div>Nothing to see here folks!</div>'; } else { 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"; } } ?>That should work, I hope.
For #3. It would be better to use your theme’s own styling, and to do this I would need to see a more normal results page in your theme that looks OK to you, then we can borrow their styling.
November 12, 2016 at 1:40 pm #69961In reply to: Hide initial results on first page load
TrevorParticipantThe code on this post:
Is correct (I have edited it to work. If you use a decent code editor with a dual pane and put the code in that post in one php file and open the standard results.php, you will see the differences, I hope. BTW, I use the free brackets.io editor (from Adobe).
November 11, 2016 at 1:50 pm #69814In reply to: Defaults for Taxonomy Searches
AnonymousInactiveI have been successful at modifying the results.php file.
Is there something similar that can be modified for the search code? I obviously don’t want to modify the code within your plugin.
Thanks,
BillNovember 9, 2016 at 12:16 am #69336In reply to: wp_pagenavi for Yoast breadcrumb
AnonymousInactiveHi Ross,
Totally sorry!, my fault. I mix two things that are not related.
Ok, so what I want to achieve is to paginate the results, like: page 1, 2, 3, 4 and like that when pagination is need it. So I find on the results.php this code that works with wp_pagenavi plugin but I´m using
<?php if ( function_exists('wp_bootstrap_pagination') ) wp_bootstrap_pagination(); ?>Any way to make it work?, why it works just with wp_pagenavi?.
Thanks.
November 8, 2016 at 10:33 pm #69321In reply to: Relevanni with Search & Filter Pro or Not?
TrevorParticipantHi, the appearance of results depends on the Display Results Method chosen in the form setup. The Shortcode method will use the (customizable) results.php template file that is in the plugin template folder (you should put a copy in your theme folder in a sub-folder called
search-filter).Depending on the HTML/JS used in the desired layout, this can be simple to do (for me).
If you use any other results display method, it will use the theme templates to display the results. The Archive method (can) most closely mimic the normal theme search page.
November 7, 2016 at 8:58 pm #69114Topic: The term of the search as title
in forum Search & Filter Pro
AnonymousInactiveHi!,
I want to display the term of the search as title in the results.php.
For example, if someone search for: “Chile”, then in the header of the results will say, “The results for Chile”.Any code to achieve this.
Thanks.
-
AuthorSearch Results
-
Search Results
-
Hi!,
I want to display the term of the search as title in the results.php.
For example, if someone search for: “Chile”, then in the header of the results will say, “The results for Chile”.Any code to achieve this.
Thanks.