Forums Forums Search & Filter Pro Search results

Viewing 10 posts - 1 through 10 (of 20 total)
  • Anonymous
    #192056

    Hello. I use shortcode method to display search results. I have search filter, and I want to change title on page from Recent posts to Search for <value from search> when search is completed. I tried to do it as js, with sf:ajaxfinish, but it dont show anymore in console. How i can do it in results page? Instead of js, if it possible.

    Trevor
    #192087
    This reply has been marked as private.
    Anonymous
    #192094
    This reply has been marked as private.
    Trevor
    #192102
    This reply has been marked as private.
    Anonymous
    #192104
    This reply has been marked as private.
    Trevor
    #192106

    Line 42 of your custom results.php looks like this:

    <div class="blog-post__title"><a href="<?php the_permalink();?>"><?php the_title();?></a></div>

    It does not need the <a href="<?php the_permalink();?>"> and closing </a> as it is not a link, and you can replace the <?php the_title();?> with code to show what you want.

    This documentation is a start:

    https://searchandfilter.com/documentation/accessing-search-data/

    But you can use more complex code that the snippets shown.

    Anonymous
    #192118

    You dont understand what I want. In blog page i have text “Recent post”. When my ajax searcg is done, i want to change this text to “Search results for: ****”

    Trevor
    #192127

    The text that says Recent post is what that line I highlighted makes. In any event that lines needs to be this instead, I think (try it):

    <div class="blog-post__title"><?php the_title();?></div>

    So, you would now need to find out if the page is filtered, like this, where the last line replaces line 42:

    <?php global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1024)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      $page_title = the_title(); 
    } else {
      $page_title = "Search results for: " . $sf_current_query->get_search_term();
    }?>
    <div class="blog-post__title"><?php echo $page_title;?></div>

    Note that this only shows the text search term. If you want fields choices, taxonomy choices, it becomes more complicated, which is what that documentation page shows how to do..

    Anonymous
    #192194

    This is similar to what I need, but not at all.
    I have blog-page.php in my theme, and in line 24 i have:
    <div class="page-blog page-blog-title">Recent posts</div>
    I want chagne this, not in results.php loop.

    I tried to put your code in blog-page.php, but ajax do not working.

    Trevor
    #192200

    When I looked at your site, you had two forms. One was using our shortcode method, and that is what is used on the page (not the template you mention). In your theme (or child theme) folder, you had a sub-folder called search-filter. In that was the results.php template.

Viewing 10 posts - 1 through 10 (of 20 total)