Jump to content


This topic is now archived and is closed to further replies.


Custom Search Results Page

Recommended Posts


I am wanting to create a custom results page. I have managed to get something close to what I am after by editing section.php within the postloop folder.


I get the feeling though that this is not the best way to go about it as changes made to this also effect standard pages and posts, i have been able to hide my search results excepts from these via css but doing so only increases my suspicion that this is not the way to go.


Many themes have a search.php file which I understand in some cases can allow you to change the way a search results page is displayed. I can't see anything that looks like this in the wp dashboards' appearance/editor and not such file exists in the theme's section folders.


So the question really is - What would you recommend using to create a customised search results page?


I would also like to add the search term and number of "hits" at the top of the results page. Using the Posts info section only displays the search term.


Also, the Pagination section only displays "previous entries" and "next entries" which is nothing like what you get at the bottom of a google search or for that matter what is represented by the sections own icon. Is there a way to customise this?





Share this post

Link to post
Share on other sites



Well it depends on what you're trying to do, how do you want your search results to display ? As I can't see anything on those screenshots that would suggest you have made some changes ?


Also, we do not provide support to users who have made changes to the core files, which it sounds like you have.

For me personally, I would either (again not sure what it is you're trying to achieve, so I'm just taking a guess) create my own custom section for search results or use a plugin. The Relevanssi plugin is quite good and comes with a number of options allowing you to customize how your results perform and display.



Please search our forums, before posting!

Share this post

Link to post
Share on other sites

  • Similar Content

    • mtaus
      By mtaus+
      How can I remove the Search function from NavPro?
    • John Olsson
      By John Olsson+
      Hello, i'm working on a webshop, and got this code to really boost the search within WP. But when adding this code to functions.php the front end media library search flipped totally, and not working at all, any ideas what's the problem?
      function atom_search_where($where){ global $wpdb; if (is_search()) $where .= "OR (t.name LIKE '%".get_search_query()."%' AND {$wpdb->posts}.post_status = 'publish')"; return $where; } function atom_search_join($join){ global $wpdb; if (is_search()) $join .= "LEFT JOIN {$wpdb->term_relationships} tr ON {$wpdb->posts}.ID = tr.object_id INNER JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id=tr.term_taxonomy_id INNER JOIN {$wpdb->terms} t ON t.term_id = tt.term_id"; return $join; } function atom_search_groupby($groupby){ global $wpdb; // we need to group on post ID $groupby_id = "{$wpdb->posts}.ID"; if(!is_search() || strpos($groupby, $groupby_id) !== false) return $groupby; // groupby was empty, use ours if(!strlen(trim($groupby))) return $groupby_id; // wasn't empty, append ours return $groupby.", ".$groupby_id; } add_filter('posts_where','atom_search_where'); add_filter('posts_join', 'atom_search_join'); add_filter('posts_groupby', 'atom_search_groupby');  
    • Queue-it
      By Queue-it+
      Search function doesn't seem to work. 
      When ever searching for something it redirect to the home page and add the search string to the url.
      For example searching for "cases" it would display https://queue-it.com/?s=cases
      Do you know how to solve that? 
    • Lisa Haran
      By Lisa Haran
      I have a map here http://www.iloveoffset.com/maps/
      I want to add several pointer locations to the map, but when I do they do not appear.
      On this map there are 2 pointer locations and as you can there is only one visible.
      Earlier today I added 7 and could only see 4 so there is something odd going on.
      My theme is up to date
    • MissT
      By MissT+
      Would be great to have the ability to include a search option within menus and within Splashup - is this possible?