-
AuthorSearch Results
-
November 19, 2020 at 10:18 am #267057
In reply to: Lost format
TrevorParticipantI see what has happened. The critical factor to recovery is whether you have a site backup of files before the plugin update was performed.
I will 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.
The result would be what you have seen. So, recovery of that file is crucial.
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 17, 2020 at 9:11 am #266668
TrevorParticipantYes, you would need to edit the results.php file, as indicated here (changing the ID shown to match that of your form):
global $searchandfilter; $sf_current_query = $searchandfilter->get(11690)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { echo '<div>Nothing to see here folks!</div>'; } else { // the current resuts.php code here (ALL the code from the if ( $query->have_posts() ) line and onwards) }
November 16, 2020 at 4:51 pm #266608In reply to: Adding Taxonomy single page to search results
TrevorParticipantCan you show me the modified results.php template that you are using to make the results?
Please post any code inside code ticks (one before the code, one after)? On my UK Windows keyboard, the code tick key is next to the 1 key in the standard part of the keyboard. If you do this Google search and look at the images, they show various keyboards and where the key is located:
November 13, 2020 at 2:33 pm #266392In reply to: Display Results In Another Style
TrevorParticipantIf you are using our Shortcode method, then the display of the results comes from our results.php file. You would need to customise it as described (in basic form) here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
To change the appearance, you would need to customise the HTML in that template. This is not something I can assist with though.
November 11, 2020 at 5:26 pm #266113In reply to: Pagination
TrevorParticipantIF you set ‘Field relationships’ to
AND
(‘AND’ reduces the number of results, ‘OR’ increase the number of results; Boolean logic) this means that if there are no results from the search field, you cannot get more results from choice in the other fields. The ‘Field relationships’ must be set to OR to get more results, which I suspect is what you want. But, then the ‘OR’ applies to all the fields. It is a little difficult to wrap your head around unless you did Boolean logic in Math lessons at school, and understood it (then or now).I am not sure what you mean by:
but how do I understand which template you use for the detail?
Do you mean that you want to show the content of the post/result on the results page? Our results.php template shows the excerpt, is that what you mean, or does not content show?
November 11, 2020 at 9:52 am #265972In reply to: Pagination
AnonymousInactiveHi Trevor,
I have three more questions:
1- I put the operator AND for the search both on “Search and filter” and “Relenvassi” but if I filter a province and also write the name of a city (which is not in the db) in the search and forward the search I find nothing. Why?
2- If you don’t find any results, how can I make it appear? I think it depends on the modified results page…
3- Every result found has the link to its detail that in the results.php page is linked in this way
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
but how do I understand which template you use for the detail? Sorry maybe this is not a question for you but I try 🙂November 10, 2020 at 4:24 pm #265839In reply to: Infinite scroll is loading too many pages at once.
TrevorParticipantI would need to see the code for results.php, but it does not look right that you have no Infinite Scroll Container. It should enclose the posts (with class ‘item’), like this (I made the code to show you, it is not in your page):
https://www.screencast.com/t/LVczF9Tk8P
If that does not work, can you show me the results.php file contents? You can share the file using a file sharing site, or post/paste the code in your reply here. Please post any code inside code ticks (one before the code, one after)? On my UK Windows keyboard, the code tick key is next to the 1 key in the standard part of the keyboard. If you do this Google search and look at the images, they show various keyboards and where the key is located:
November 10, 2020 at 3:12 pm #265815In reply to: Pagination
TrevorParticipantI would need to see the code for results.php, but that does not look right. Can you show me the results.php file contents? You can share the file using a file sharing site, or post/paste the code in your reply here. Please post any code inside code ticks (one before the code, one after)? On my UK Windows keyboard, the code tick key is next to the 1 key in the standard part of the keyboard. If you do this Google search and look at the images, they show various keyboards and where the key is located:
https://www.google.com/search?q=back+tick+code+key
As to the search. I think you may be able to restrict the text search to just two fields. Our plugin does not directly allow you to do text searches of individual Post Meta (custom fields) and Taxonomy (Category, Tags and Taxonomies) data/terms. The Search & Filter Pro Text Search field uses the standard WordPress search, so looks only in the Post Title and Content. To help you control this better, on the form’s Advanced settings tab you will see 2 settings for Relevanssi.
The documentation for this is here:
https://www.designsandcode.com/documentation/search-filter-pro/3rd-party/relevanssi/
You would need to install and activate the free Relevanssi plugin as well.
Then set Relevanssi up and build its index (make sure it is indexing the desired post types, custom fields AND any taxonomy that you want to search).
What I am not sure is if you can exclude the title, content, etc in the Relevanssi settings. You may need to use hooks in Relevanssi to force it to NOT look at title for example, see this post:
https://support.searchandfilter.com/forums/topic/search-and-filter-only-in-title/#post-93961
November 10, 2020 at 2:28 pm #265810In reply to: Pagination
AnonymousInactiveThanks for the help, I tried, the results.php page is composed as follows:
global $searchandfilter;
$sf_current_query = $searchandfilter->get(11690)->current_query();
if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()==””)) {
echo ‘<div>Nothing to see here folks!</div>’;
} else {
// the current resuts.php code here
}?>
<?php
while ($query->have_posts())
{
$query->the_post();?>
<div class=”farmacia”>
<h2 class=”nome-farmacia”>“><?php the_title(); ?></h2>
<?php the_content(); ?></div>
<hr />
<?php
}
?>If I go to https://www.staging2.biotechmed.it/farmacie/ it shows me all the results… My client does not want that someone can easily see all the results and download all the names.
Another question, is it possible to search only in two specific fields and ignore the others in the search?
-
AuthorSearch Results