Jump to content
Sign in to follow this  
btwixt33

customize search results page

Recommended Posts

btwixt33

I am using PlatformPro and am using the Relevanssi plugin to improve the search function on my site. I would like to customize my search results page even further by adding links to filter the search results by date (http://www.relevanssi.com/knowledge-base/by_date/). Can you please tell me where to add the sample code that is given in that tutorial? I looked in both search.php and template.postloop.php and don't see where this code would be inserted. Thank you.

Share this post


Link to post
Share on other sites
Danny
Hi Btwixt, I also use this plugin for my searches and although I don't use the by date setting, I added a small bit of code to display "You searched for X, here are the results". I changed my custom function to incorporate your code and it works, as far as I can see. So here is how I did it. First, goto your functions.php file located in "/wp-content/themes/platformbase". Then open the file and add this code at the bottom of the file. // Search Results by Date // add_action('pagelines_before_theloop','searchresults'); function searchresults(){ if (is_search()) : ?> results from the last day

'; ?>

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
btwixt33
Thank you so much. Got it working perfectly. Do you know how they remove the hyperlink and make the current selection bold on this website? http://www.rapliq.org/en/?s=buses&by_date=1d. I know I can use CSS but how do I check to see which filter has been selected?

Share this post


Link to post
Share on other sites
Danny
Hi Btwixt, When you say "Do you know how they remove the hyperlink" can you explain in a bit for detail please? As for the current selection, from what I can see it is already bold from. .adv_search_active_filter { font-weight: bold; }

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
btwixt33
On that website when a filter is active, they remove the hyperlink and make the selection bold. For instance if I select 'the last 7 days', when the page reloads, 'the last 7 days' is no longer a link and is bold. I see in their CSS that they use the piece of code you found to make it bold. My question is how do they determine which filter link is being used to filter the selections. Hope that makes sense.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×