Forums › Forums › Search & Filter Pro › PHP Code to Display Search Terms on Search Results Page
- This topic has 6 replies, 2 voices, and was last updated 9 years, 5 months ago by Anonymous.
-
Anonymous(Private) May 23, 2015 at 8:36 pm #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(Private) May 23, 2015 at 8:48 pm #18151Here 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(Private) May 27, 2015 at 8:32 pm #18367Hey Katie
Do you have a link to the form on your site that I can look at?
Thanks
Ross Moderator(Private) May 27, 2015 at 9:19 pm #18377Hi 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
-
AuthorPosts