There is a lot you can do with WordPress regarding searching your blog. You can use the built-in search capabilities, replace it with a search from Google or Yahoo (or whoever), or use an awesome WordPress Plugin called Search Everything to really get full advantage of searching your blog.
Let me explain what and how the built-in search function works with WordPress, for those left confused and frustrated as I was.
How WordPress Search Works
When you search in your WordPress blog, your search results are listed chronologically. Not by “most likely”, “most popular”, “most frequent use of the phrase”, or even alphabetically, just by date. And the chronological order runs from most recent to oldest. If the most likely post to provide the information the user is searching for is older, they will have to scroll towards the end of the list to find the most likely candidate for information. What are the odds they will, huh? This frustrates me no end.
Another frustration with WordPress searching is that it only searches posts. It does not search comments nor Pages. Only post content.
Another thing happens internally that the user never sees, but you, the administrator and/or Theme designer, need to know about. By default, there is a hierarchy to the order of which template is used for which request. A Theme may, or may not, have these optional template files to generate specific web pages, page elements, and looks. In the case of search, when the user clicks the SEARCH button, WordPress looks for a
search.php template file. If it doesn’t find it, it will generate the search on the
index.php template file.
You can see examples of my main website’s custom
index.php page and custom
search.php page to get a feel for how these can be customized. The index page features huge excerpts and graphics, while the search results excerpts are shorter, but look similar in design.
A Theme doesn’t have to have a custom search template page, but if they do, it allows customization of how the search results look and feel. Nothing has to be changed within the rest of the templates in order for a custom search template to be added. If you want to add a custom search template, simply copy the
search.php template file from another WordPress Theme, or make a copy of the
index.php template file and rename it
search.php, then style it to match whatever you want your custom search page to look like. No special coding is required. WordPress will automatically find it next time you go to search. Hopefully. 😉
Replacing the WordPress Search
To replace the built-in WordPress search functions with a search engine search function, simply sign up and get the XHTML codes for the search engines search function and edit the
searchform.php to remove the built-in PHP search functions and replace them with your new code. The WordPress code looks approximately like this:
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/"> <div class="searchinput"><input type="text" class="inputbox" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" /> <input type="submit" id="searchsubmit" class="button" value="Search" /> </div> </form>
Be sure and test the search engine search functions thoroughly, and style the search engine search to match the look of your WordPress Theme, if necessary. Some search engine functions will allow you to specify a search results page, so if you can, why not make the search results look like your WordPress Theme by generating them on a
search.php template file to match the overall look.
The Search Everything WordPress Plugin – Easy Search Expansion
To get around the limits of the WordPress search functions, without replacing it with a search engine search form, the Search Everything WordPress Plugin expands the search results to include comments and Pages, though currently it also returns only chronological results, from most recent to oldest posts.
To install Search Everything, upload the plugin to your
wp-content/plugins folder and activate it through your Plugins Administration Panel. That’s it. It works. If you have messed around with your
searchform.php template file, you may encounter problems, so check through the comments on the Search Everything WordPress Plugin page for more help, or ask.
Site Search Tags: wordpress, search, plugins, searchform, search.php, index.php, search+engine, search+everything, wordpress+plugins, wordpress+search, custom, customization, search+results
Copyright Lorelle VanFossen