A major focus in the design phase of our projects is UX, or more importantly, how a user navigates the site in order to find what they’re looking for. Now I don’t claim to be a designer by any means (Dean can confirm), I have a more Ron Burgundy like approach to my work, I code (read) exact what’s in the design (teleprompter). However, I am a user! And in saying that I know how frustrating it can be to navigate through countless menus and search pages to find what you’re looking for.
Every WordPress site should have an easy to use search tool. Be it a small blog site, through to a multi-product E-commerce store. In all likelihood, you have come to the same conclusion as I have, the default WordPress search function sucks! It might work for some sites, but it is very limited.
There is a solution to this in the form of plugins, but I want to focus particularly on a paid plugin called FacetWP. FacetWP elevates your sites search beyond the default WordPress search, getting you to the content you want in a fraction of the time.
Now right off the bat, let’s get the elephant out of the room. FacetWP is a paid plugin with two tiers, $99 (approx. £74) a year for 1-3 sites and $249 (approx. £186) a year for 20 site activations. The plugin, unfortunately, does not offer a free trial, instead opting to let you try the plugin first-hand on their site before buying.
With the pricing out of the way, let’s get on to the good stuff!
Facet, noun, meaning; a particular aspect or feature of something. With FacetWP’s smart filtering users can find a particular product, blog or post faster as the plugin uses AJAX to dynamically filter the content on the screen without the need to reload the entire page.
The plugin interface couldn’t be any easier to use. FacetWP uses the post meta and custom types you already have created for your site, it even integrates with Advanced Custom Fields, which is a must for us to achieve the bespoke filtering we need on our sites (Interested in Advanced Custom Fields? Check out some of my previous blogs, where I deep dive into some cool functionality with the plugin here).
Once the plugin is installed you head over to Settings > FacetWP. In the example above I have shown how easy it is to create the facet for post categories. You just need to give the facet a name, choose the type and data source, in this case, I chose the Categories taxonomy. Once the facet is complete and you have saved and reindexed the data, you can then copy the shortcode it gives you into your codebase to view it on your site.
I touched on the AJAX integration above to create faster load times, but a great feature the plugin enables is the ability to use AJAX pagination. In short AJAX pagination allows you to load more posts, results or products on the page without having to reload the page, which is almost a staple in every E-commerce site you see today. FacetWP allows you to create this functionality within seconds. When creating a new facet, simply change the facet type to “Pager” and select from the list what pager type you want, from standard pagination to a load more button. This shortcode can then be added after your main WordPress loop.
FacetWP has great documentation for developers to take full advantage of the plugin’s hooks. One common problem I should mention (after a lot of troubleshooting) is if you intend on using this plugin alongside a custom-built WordPress theme, FacetWP tries to automatically detect the loop you are trying to filter from and it will add the class facetwp-template around the loop. During an ajax refresh, FacetWP will only modify content within that container element. This can become tricky if you are using a WP_Query or have multiple loops on one page, so a simple solution (but not so blatantly obvious to me) is to add the facetwp-template class to the container element of the loop within your codebase. FacetWP will no longer have to try and find the custom loop and could save you the time and hassle of having to use the good old Stackoverflow troubleshooting.
FacetWP is constantly being updated, to improve the UI and by adding great new features to the plugin. One of which (now my favourite part of the plugin) is the new “Sort By” facet.
We have all seen the sort by dropdown before on many sites, and this update is not necessarily changing the formula as Sort by functionality has been available to developers for years now on WordPress, be it with WooCommerce for example. Even FacetWP itself had this functionality available but required adding to your functions.php in order to change the feature set.
With FacetWP v3.9 this all changed. From the team themselves “This was the most requested feature on our feedback site…“. We can now create our own “Sort By” using the built-in editor. Say for example’s sake if you have an events post type, and it uses an ACF field for the event date. You can now order by upcoming events rather than the default WordPress post date. You can also create AND sort options, if two events were on the same date, you could change the sort options to order by upcoming date and alphabetical order.
You can also find the full feature set here.
FacetWP has changed the way I approach developing WordPress sites for the better. It’s easy to use UI, giving users from all areas of expertise the advanced WordPress search that only the default search can aspire to be. I have only scratched the surface on the extensive features this plugin has to offer, making it well worth the asking price. For me personally, the plugins plethora of developer tools and documentation, and its lightweight library, make it a must-use plugin on any future projects I work on.
P.s. This is not a sponsored post.