Technologies Involved
- WordPress Categories
- WordPress Widgets
- Category Posts Widget Plugin
- Yoast SEO
The Problem to Solve
The seemingly simple task of working with and deciding on categories for your content is a series of puzzling decisions for most websites. This post addresses one of those issues. If a Post can be attached to many categories, and if being attached to a category triggers another function, which function of the many categories will be triggered?
The Example
The inside pages on this site have a right sidebar. Widgets can be added to that right sidebar. The Category Posts Widget Plugin picks up the most recent 5 posts in a Category, but which list of posts should show if the post is attached to many Categories?
Here is a screenshot from a post about Image Captions. In the right sidebar, it shows a list of 5 other articles in the UX – UI Posts category, which is what I want. But it also shows a list of 5 posts from Coding and Languages, 5 posts from WordPress and 5 posts from SEO & Social Media, which I don’t want.
The plugin is doing exactly what I told it to. It’s picking up links to posts in categories that I assigned to the post … but I assigned that post to many categories. So, it’s helpfully making the right sidebar longer than the article itself.
How to Set up the Post Lists
- Install the Category Posts Widget Plugin. As of this writing, the plugin is up to date.
- Go to Appearance -> Widgets in the WordPress Dashboard (1)
- Drag Category Posts (2) into a Sidebar as shown in (3).
There are quite a few options to get through in the Widget.
- First, create a title for your widget. In the example, the title has been set to SEO & Social Media
- Set a Filter for your widget. The example has been set to 5 posts from the SEO & Social Media Category.