Using WordPress Custom Post Types and Custom Fields allows us to easily organize our site’s content and can make updates much easier for non-technical users. Unfortunately, once the amount of content in these areas starts to grow, it gets much more difficult to find what you’re looking for in the WordPress admin area.
For example, imagine that you’ve created a new custom post type called “Staff”. It’s a dedicated area of your site where you’ll provide biographies of all the staff members in your company. You create a custom Taxonomy called “Department”, which will be a set of special categories to organize staff members by the particular department they work in.
If your company is rather small, say 10-20 employees, keeping track and easily finding staff members in the WordPress admin will be quite simple. But if you have a large company, you might find yourself scrolling through several pages of posts to find what you need. This is not exactly the most efficient way to do things.
Whether you have staff listings, events calendars or any another content that has become difficult to manage, setting up some filters in the WordPress Admin can make the task much easier.
WordPress Admin Filters
The tool we’ll use to bring back some sanity to our custom content is WordPress Admin Filters. This plugin will allow us to create drop-down menus or search areas on top of our post listing pages that we can use to find the exact content we’re looking for.
We’ll use our fictional Staff custom post type as an example. I’ve created posts for 60 staff members in various departments. Without filters, what you see is just a long list of posts. There’s no way to sort the posts by which department the staff members belong to. There’s not even a way to see their department until you actually go into the post itself.
Setting Up a Filter
With WordPress Admin Filters installed, I simply click on the Admin Filters menu inside of WordPress and then choose “Add Filter”.
The interface is simple enough, but thankfully the plugin does come with a handy usage guide. Among the options:
- Label: The name of the filter you’re creating, which will show up in the post listing. Let’s call this filter “In Department“.
- Display On: A drop down list of the registered post types on your site. We’ll select Staff since that’s the area where we want to display the filter.
- Filter Type: Here you can choose between Taxonomy (which is the one we’ll use), Custom Field or Post Field. This gives you the flexibility to look for values inside of your posts. You could do some very powerful and specific filtering with this feature.
- Filter Type Value: Provides a listing of the different items you can filter. This all depends on what you’ve selected in Filter Type, above. In our case, a list of taxonomies is provided. We’ll choose the Departments taxonomy that was created earlier.
- Comparison: How do you want to compare items in order to filter them? The choices here are IN (posts in the taxonomy), NOT IN (posts which aren’t in the taxonomy) and AND (useful if you have more than one taxonomy/custom field/post field in your filter). IN is the choice here.
- Comparison Type: While not needed in this particular example, the Comparison Type field is used when filtering numeric content, dates, times, etc.
There are also checkboxes available to use Ajax in the filter to speed up the search and Multi which will allow you to filter by more than one term (ex. get posts in the Sales and Executives departments). Just for fun, let’s enable both.
Going back to the Staff listing, there’s now an “In Department” filter at the top of the screen.
Enabling Ajax allows us to simply start typing the name of the department we want to filter by and the system will bring up relevant results. Now, instead of guessing who’s in the Sales department, we can see exactly who’s there. Using the Multi-feature means we can add a second department to the search.
Unwieldy Content: Tamed
After installing WordPress Admin Filters, it took about a minute’s worth of work to create a filter. In that minute, we took a custom post type with 60 entries and made it easy to sort through. This is a terrific way to make sorting through large collections of content a piece of cake.
Feature photo: copperpipe