When we create websites with WordPress, it’s easy to get distracted by all of the amazing tools, plugins, and themes, and forget that the content is most important.
If relevant information is difficult to find on your website, then all of the time you spent creating it will ultimately be overlooked. Naturally, the easier you make it for visitors to navigate to content that is both relevant and useful to them, the more time they’ll stay engaged with your site.
Traditionally, WordPress sites have relied on a sidebar with a list of recent posts, categories, tags, and a search widget to keep users engaged. For many reasons, this simply does not cut it today. These static lists of links add multiple page loads to the process of getting to new content. Every page load is an opportunity for a visitor to get distracted and leave. Beyond that, static lists don’t adapt to input from users.
That isn’t something that can be solved with a search widget alone.
The WordPress default search functionality only searches in post titles and content. However, what if the information the user is looking for is in a custom field? You’re out of luck. This is especially true if you’re running an eCommerce site where important information about your products is stored in custom fields.
Also, isn’t it a shame that we spend so much time distilling our posts down into tight SEO descriptions, designed to be used in a search, and yet they cannot be used to search our own websites? What a waste. But don’t worry we can fix that while writing almost no code by using two cool plugins, SearchWP and FacetWP.
Beyond Text-Based Search
Faceted search, an information-accessing technique that works by giving users multiple filters to refine search options, is popular on eCommerce and other information-heavy sites. The sidebar on an Amazon.com search results page is an excellent example of faceted search. Faceted search is an effective way to let your users quickly navigate to the exact content they want, on any type of site. To implement facet search on a WordPress site, you can use FacetWP.
FacetWP works by combining one or more search “Facets” with a template that’s updated without a page load whenever the user makes an input to a Facet. Facets can be used to search post types, taxonomies (including categories and posts), and custom fields. Facets can take the form of a drop down, slider, autocomplete, checkbox, etc.
When SearchWP, the advanced text-based search plugin I will be discussing later in this article, is active it can be used to power a keyword search Facet. But what makes FacetWP special isn’t just the easy filtering of data, but how quickly and immediate the results are provided. Since the results are updated via AJAX, no page loads are required. This allows users to quickly try multiple combinations of search parameters. To see some good examples of FacetWP being used, check out the knowledge base section of the SearchWP documentation, which is powered by FacetWP.
This type of system is perfect for allowing users to easily search and refine searchs by multiple parameters. In eCommerce and other sites with lots of meta data, the reductions in page loads and ease of use is essential for keeping users from leaving before purchasing a product or finding the information they need.
While all FacetWP setup is handled via an admin panel, setting up Facet templates does require a small amount of coding in the admin panel. Luckily the code is just a set of WP_Query arguments and a standard loop.
The FacetWP site has excellent documentation for creating templates. In addition—since the code is so standard—the codex documentation for WP Query and the countless articles and tutorials about WP_Query are also available to assist you.
Outputting your Facets on the front-end is very simple and uses shortcodes. This means that creating your search page is as simple as adding a few shortcodes to the page editor. If you want to add pagination, or links for reordering the results, it’s as easy as adding additional shortcodes.
Traditional Text-Based Search, but Better
FacetWP gives you a whole new way of creating search options on your site, which is especially well-suited for sites with lots of meta data in custom fields. Sometimes what you need is a really good keyword search. And by really good, I mean fast, pre-indexed, and endowed with the ability to search in more than post title and post content. For that task, SearchWP is hard to beat.
There are some plugins that don’t require any setup. You simply install them, maybe enter a license code, and they work. Others require setup in the admin and writing a bunch of code. Both can be used to describe SearchWP.
Once you activate and authorize SearchWP, it takes over the built-in WordPress search functionality. The same search form you’re used to using from the search widget or get_search_form() still works—it’s just better. Similarly, the same search.php template in your theme is still used to display results.
While the user experience for your visitors is the same, the results are not, nor is the technology behind it. SearchWP indexes your content in a separate database table allowing for faster search based on more data points. From the admin panel, you can configure SearchWP to search in different fields, including both default and custom fields. It also lets you weigh sources differently on a per content-type basis.
For example, for your blog posts you may want to give more weight or emphasis to certain excerpts and assign a lesser weight to results from custom fields. If your site has an eCommerce plugin that adds a product’s custom post type, you may want to emphasize custom fields over post content or post excerpt.
The default WordPress search functionality can be set to search in custom post types, but in many cases it doesn’t make much sense to combine search in posts and pages with search in custom post types. This is where SearchWP’s most powerful feature—supplemental search engines—comes into play.
SearchWP lets you set up multiple, separate search engines. In each search engine, you can set any combination of content types to search in, and set up how you want SearchWP to weight results from the different sources. It takes some work to set up your results, but the process is well documented. For an example of a search form that allows you to search in multiple SearchWP search engines, you can test out the one we created on the Pods website.
The Right Content, Faster
After all the time you spend worrying about choosing the right theme, plugins, host, caching system, color scheme, domain name, search engine optimization, and the countless other things that go into creating a WordPress site, in the end the content is the most important component of your website. It’s critical to never lose sight of that.
While we spend so much time talking about ways to get people to our sites by focusing on SEO, and getting the site to load quickly by focusing on server setup, caching, and so forth, getting site visitors to the right content is often one of the most overlooked aspects of site development. With the right tools, such as the two I’ve discussed in this article, getting site visitors to the right content couldn’t be easier.
Josh Pollock started learning WordPress development when he was supposed to be working on his masters thesis, which ended up being about open source solutions for sustainable design and was presented in a WordPress site. You can learn more about him at JoshPress.net or follow him on twitter @Josh412