-
AuthorSearch Results
-
January 27, 2021 at 5:33 pm #274289
In reply to: Mashup Maps Integration
TrevorParticipantYes, just like that. Show him the results.php file from our plugin templates folder. I will leave this open unless you think I should close it?
January 27, 2021 at 7:59 am #274198In reply to: First session without results, how to do it?
AnonymousInactiveHello Trevor,
can you please confirm the following?1) I’ve created a custom results page with the ID (14) of the search form…
wp-content\themes\my-child-theme-name\search-filter\14.php
2) … I’ve put all the current php code, except:
if ( ! defined( 'ABSPATH' ) ) { exit; }
3) … in the section commented “// the current results.php code here”
global $searchandfilter; $sf_current_query = $searchandfilter->get(14)->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() ) { ?> ...
Is the above procedure correct?
If I need to translate the website (using WPML), do I need to create a new search form and a new custom results page (so with another ID)?Thanks.
January 27, 2021 at 6:06 am #274170In reply to: First session without results, how to do it?
TrevorParticipantUsing the Shortcode method, you would need to edit the results.php file, as detailed in this post:
You would need to follow our guide when doing that:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
January 26, 2021 at 4:54 pm #274060In reply to: Autosubmit on initial load (no infinite scroll)
TrevorParticipantIn the Search & Filter plugin folder, in the subfolder named templates, are two files. Normal pagination template is
results.php
, and there is another for infinite scroll, with a similar but different structure.Which one did you use?
Whichever one you used, I assume that you first followed our guide when doing that:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
The file must be renamed to either results.php or {the number of the form ID}.php
What you should have done (and maybe did not) is to copy the
results-infinite-scroll.php
template file to your child themesearch-filter
folder, and then rename that copied file toresults.php
Then you would edit that file, making sure to keep the general structure and some of the classes intact. The key classes in that file are:
search-filter-results-list search-filter-result-item
Using ftp (or some file manager), rename the current results.php template file and bring over a copy of the infinite scroll default results file and rename that to results.php. It will not look so good, but it will take things back to basics to see where the issue/problem lies.
If the correct number of posts now show, and infinite scroll works, then you will know that there is an error in your custom results.php code, so I would then need to asee a copy of that file.
January 25, 2021 at 6:10 pm #273929In reply to: Mashup Maps Integration
TrevorParticipantTo test whether it worked, I used our Using a Shortcode display results method, following the guide here, and the customising section (so I had my own copy of the results.php file):
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
On each post for which there was a map needed, I made a map in wpgmaps and noted the ID.
Using Advanced Custom Fields, I created a ‘map_id’ custom field for these posts, and then added against each post the relevant map ID. I also made a parent map, and noted that map ID.
Before the while loop starts in the results.php template (‘the template’ from now on), I defined two variables:
$post_content_output = '';
$map_output = '[wpgmza id="2" mashup=true mashup_ids="';
where 2 is the parent map ID (so change to suit).
As each loop of while is run, you output the strings into
$post_content_output
and add the post map ID to$map_output
, with a comma after each ID.When the loop has finished, you need to trim the last comma off
$map_output
, then add'" parent_id="2"]'
to it. That should complete it as a mashup shortcode.Then you have two variables to echo to the page (one as a do_shortcode function).
I no longer have a copy of the results.php I used, sorry, so you would need to code this yourself, but the logic is as above.
This was the reference I used:
https://www.wpgmaps.com/documentation/advanced-map-options/map-shortcode-parameters/
January 23, 2021 at 10:45 am #273770In reply to: Search Results before Query is Submitted
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(6745)->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) }
January 22, 2021 at 5:01 pm #273715In reply to: Pagination problems
TrevorParticipantAre you able to send me a live link/URL to your search page so I can take a look?
I am not sure why you are trying to combine the category template with our results.php template?
The filter_next_query shortcode would normally be used only if the form is set to Custom display results method.
January 22, 2021 at 2:25 pm #273663Topic: Pagination problems
in forum Search & Filter Pro
AnonymousInactiveHi,
I have a category template I am using with my shortcode <?php echo do_shortcode(‘[searchandfilter id=”3136″ action=”filter_next_query”]’)?>
I have the standard WordPress pagination in the template – so at the moment the pagination does not work with the search results, it acts independently of the filter results.
I don’t know how to combine the results.php with the category template to use the searchandfilter pagination.
January 22, 2021 at 2:06 pm #273649In reply to: Customize Filter Inputs Layout
AnonymousInactiveOf course I know the documentation and made safe changes to results.php before 🙂
January 22, 2021 at 12:13 pm #273620In reply to: Customize Filter Inputs Layout
TrevorParticipantThis is the guide to making ‘safe’ changes to our results.php template:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
Do you need to style the form itself? If you share with me a live link/URL to your search page so I can take a look, I might be able to give you some custom CSS, but you would need to show me, with one or more annotated screenshot(s), the design change(s) you want? If you can do that, you would need to upload the screenshot image(s) to a file sharing site (like the WordPress Cloudup site, Google Drive, Weshare, Dropbox etc.) and share the link with me?
-
AuthorSearch Results
-
Search Results
-
Topic: Pagination problems
Hi,
I have a category template I am using with my shortcode <?php echo do_shortcode(‘[searchandfilter id=”3136″ action=”filter_next_query”]’)?>
I have the standard WordPress pagination in the template – so at the moment the pagination does not work with the search results, it acts independently of the filter results.
I don’t know how to combine the results.php with the category template to use the searchandfilter pagination.