Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro First session without results, how to do it?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Michele
    #274146

    Hello,
    I need to activate a “Ajax” search form in the home page but without results when a user open it the first time.
    I’m using “Beaver Builder Posts Module” to see the results but I don’t have problem to change it with the “shortcode” modality, but before I’d like to know how start the session without results on the page.
    Thanks.

    Trevor Moderator
    #274170

    Using the Shortcode method, you would need to edit the results.php file, as detailed in this post:

    https://support.searchandfilter.com/forums/topic/search-results-before-query-is-submitted/#post-273770

    You would need to follow our guide when doing that:

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results

    Michele
    #274198

    Hello 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.

    Michele
    #274219

    Another question… is it possible to have in the dropdown menu, the voice “All” that selecting it load all the results?
    Is not important (I can change the name from “All” to “Select”), but this option would give the search a full function.
    Thanks.

    Michele
    #274358

    Another “little” request… I’ve inserted this code in the page to show the taxonomies but I don’t know how to customise it (e.g. change the separator “,” and remove the “and” for the last value when the list is multiple and the dot at the end “.”, remove/change the taxonomy title before of the values):
    <p><?php the_taxonomies(); ?></p>

    How can I do it?

    Trevor Moderator
    #274475

    The code looks OK. When you translate a form it gets a different ID, so you can do the same but with a different filename instead of 14.php for example.

    I have not seen an easy way to change the All label, you might need to use JavaScript to do this.

    As for that function, I can only refer you to the WordPress Codex for options:

    https://developer.wordpress.org/reference/functions/the_taxonomies/

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.