FacetWP – a semi-tutorial
Why I Like It
You can see all the bells and whistles on the demo page. The brass tacks version is that it allows you create a variety of guided search options and create custom page templates with or without the search pieces. I’ve used it personally and on rampages in a few slightly different ways.
- Here it is just using the custom display (no search) to show 3rd Space related images and I’ve used it to do something similar on this page with posts from my blog in the ‘Photography’ category.3
- On this site, it’s allowing faceted searching based on tags created by students through a Gravity Form.
- Another example that’s using two facets (date and work type) based on parent/child category relationships to sort out my work.
Given I’m working in a fairly large WordPress multisite environment, there are a few things that make FacetWP particularly appealing. I could create all sorts of custom child themes for various needs. That works but I worry about having lots of child themes cluttering things up, being activated on a per site basis– basically creating things that I am pretty sure no one on the user end will ever be able to take over, adjust or make for themselves. I don’t necessarily think lots of users will ever try their hand at FacetWP but the option for them to do so exists. I also like that the tool itself is not so tightly tied to a particular theme. It can travel as people change their minds and the only piece that needs adjusting will be the CSS.
How It Works
There are essentially three interrelated pieces- the facets (if you want to search/sort), the template (functional display), and the CSS (making your functional display extra pretty). You then put these within a page or post4 using shortcodes.
You can tie into a huge variety of options, including custom post type fields. You can make a lot of these and use them alone or in combination. You then add them via the shortcode based on the name you gave them- for example if I named my facet “years” then I’d embed it with the following shortcode [facetwp facet=”years”] and I could add other facets I made below it with the same naming conventions.
Templates take this plugin to an entirely different level. You can do a bunch of different things here. The template has two pieces, the first is a way to restrict what shows up from the entire corpus of blog content and the second lets you define what pieces show up. It’s essentially the power to build custom page templates with lots of sophistication without having the kind of access normally needed. You embed them in the same way as facets- [facetwp template=”thumbnail”] would embed the template named “thumbnail.”
Then you polish it all up with some CSS to make the facets and template pieces display the way you want within the theme you’ve chosen. I’ve started throwing up some basic combinations of these elements on Github so they’re in one place for reuse. So far the CSS has traveled well between themes.