As a WordPress developer, I love to geek out when building client sites. Finding excuses to use shortcodes, leveraging page templates & custom fields to standardize design and imagining better data structure with custom post types are part of my daily joys.
My clients however couldn’t care less. In fact, most of them don’t even understand what I did to create the customized admin interface that they assume to be “standard WordPress” anyway. All they want is something that works well and is easy to use.
That’s good news for WordPress, which a great CMS solution: all about making things work, keeping content organized and providing edit tools that are intuitive.
A few months ago, I was working on a custom WooCommerce project that sold products so complex that the FAQ page became a rather important part of the puzzle. Their old site’s FAQ page was just a bunch of answered dumped onto a page. As a result, a large part of the owner’s time was wasted responding to inquiries already answered on the website. So I searched the repository for some cool FAQ plugins to use and what I found was very interesting.
All the popular FAQ plugins, such as WP Awesome FAQ Plugin and SP responsive wp-faq plugin, were highly-involving custom post-type based solutions. The philosophy behind them is that 1 question = 1 post so that the questions can be organized by taxonomies and displayed with templates.
Custom Post Types are too involving for some cases.
There is no doubt that these plugins are well engineered and that custom post types are an amazingly fun and powerful feature to use, but they have a strong short-coming. Anyone who has committed to a custom post-type driven plugin and decides to switch to a different solution knows what I am talking about: there isn’t an easy way to keep your data if the name of the post-type is different from one plugin to another. Savvy WordPress developers can attempt to edit the database manually; but for regular users it’s a nightmare of copy-pasting.
In fact, for something like FAQs where there are many small questions and answers that just creating such a large amount of posts can be a irritatingly repetitive task. Even when that’s done, there will be extra work teaching the client to use said system and explaining its value.
There has to be another way.
That’s what I told myself when thinking of the best solution possible to keep my client’s FAQ page simple and yet easily search-able.
I pondered that one of the core features behind the success of WordPress is that it provides a standardized way to format content. All posts, taxonomies, users and settings can be exported and maintained across installs, updates and themes. This is also why HTML itself works: all browsers expect the same tags and know how to display them.
Every page has headers.
In my search for the most obvious solution possible, I realized that just about every page online that is longer than a couple paragraphs makes use of HTML header tags. They structure the page visually, making it easier to browse and skip right to the content that sparks your interest.
So why not simply index those headers?
That’s exactly what I did. I wrote up some jQuery to browse the FAQ page for headers and generate a list of index links on the fly. Upon clicking one of those links, a user’s browser will scroll straight down to the header it indexes.
Combined with a contextual search form for users who aren’t blessed with knowledge of the on-page search available with modern browsers; I had created an elegant solution to simplify searching through an entire FAQ. It was so simple to implement that I was literally able to copy-paste their old FAQ page from a non-WordPress site. As for my client they will never have to worry about managing dozens of posts or manually editing a list of anchor links.
So came the Search & Index Page Content plugin.
I have released this solution in a simple, unobtrusive plugin format. Simply sliding a widget into the sidebar and wrapping a page’s content with a shortcode will reveal the search form and headers index links… for that page only. Search & Index Page Content works for any WP 3.6+ install, as long as your post or page to index contains headers.
So next time you are over-engineering a solution to a basic web design problem using WordPress, try to ask yourself: “isn’t there a simpler way?”.