For 2.5 years now – time flies when you’re having fun – I’ve been helping the users of The Events Calendar and co. solve their issues with the plugins from Modern Tribe. In a lot of cases, especially when it comes to some customization, I usually share snippets with them through Gist by GitHub. But searching in that repo makes my eyes twitch. So …
So I was thinking how I could make it easier for myself to search through the snippets I have created (70 and counting), and how I can possibly make it easier for others to do that.
Since I have this experimental site – I created it for a demonstration for WordCamp Switzerland 2018 -, it looked like a perfect location for another experiment. Now what do we need?
A custom post type for gists. I used Custom Post Type UI for that and created the ‘Gists’ post type. Nothing special, like a post, with hierarchical categories and tags.
The category is actually the related product. It is possible to narrow down the functionality to one product only in 95% of the cases, which is good.
Then tags what the whole gist / snippet is about in short keywords, usually the name of the option or function. The number of tags used per snippet needs to be as little as possible, to avoid clutter. There are still 73 tags now. And I’m sure this will grow. Maybe I’ll need to think about a system for this or some structure.
Some searching and filtering plugin is needed, of course, since this is the main purpose of this experiment. First I tried WP Custom Fields Search, but after a bit of tinkering I found some limitation. I believe I could not do an ‘OR’ search, only an ‘AND’ search, which rendered it almost useless.
So I tried Search & Filter next, which seems to be working perfectly for my case.
Then I used WooSidebars, so I can have a custom sidebar on my gists pages, which would only include the filters. (Filters are added via a shortcode to an HTML widget.)
And some template customization and custom coding for the looks. I’m using a child theme of twentysixteen and created some templates and CSS for the gists, removing the superfluous clutter for these pages.
The longest was getting my gists in here. That took about 3-4 hours. (Ah man, that was boooooooooooring.)
And I ended up with this:
Now comes the test phase. This can actually work. 🙂