Forums Forums Search & Filter Pro PHP Code to Display Search Terms on Search Results Page

Viewing 7 posts - 1 through 7 (of 7 total)
  • Anonymous
    #18150

    Hi,
    Thank you for the great plugin! I am using a custom template for the search results page. I’d like to add the search terms visitors selected in the title on the search results page. Something like…”Here are the Search Results for Your Search for “Accountants, “Blue”, “Clean”…and then have the results listed below.

    What is the php code that should be placed in the custom template to show the search terms?

    Thank you!

    Katie

    Anonymous
    #18151

    Here is the code I am using on the custom template page, and only the words “Search Results for:” are appearing. The terms are missing…

    <?php if ( have_posts() ) : ?>
    <h2>Search Results for: <?php the_search_query(); ?></h2>
    <?php while ( have_posts() ) : the_post(); ?>

    <!–Results Show Here–>

    <?php endwhile; wp_pagenavi(); else: ?>
    Nothing found
    <?php endif; ?>

    <!–End of the Loop–>

    Ross Moderator
    #18367

    Hey Katie

    Do you have a link to the form on your site that I can look at?

    Thanks

    Anonymous
    #18369
    This reply has been marked as private.
    Anonymous
    #18370
    This reply has been marked as private.
    Ross Moderator
    #18377

    Hi Katie

    Ok I see what you mean 🙂 Currently there is no particularly easy way to do this (I want to add some functions to S&F to make life easier) but there is some code I’ve been playing around with and suggested to other users:

    https://support.searchandfilter.com/forums/topic/how-to-show-cats-title-in-search-result/

    If you were looking to do the same with fields generated from the Advanced custom fields plugin then you could check out this post:

    https://support.searchandfilter.com/forums/topic/showing-results-under-x-and-y-and-z/

    Let me know if that helps!

    Thanks

    Anonymous
    #18383
    This reply has been marked as private.
Viewing 7 posts - 1 through 7 (of 7 total)