This is a feature of the Feast Plugin
The Simple Category Index lets you create a simple visual index of your categories, by leveraging the Category Featured Images.
Just insert the simple_category_index shortcode wherever you want to display a list of categories, like on the homepage and posts. Calling the shortcode with no additional parameters will output all eligible categories.
If you've embedded the category name into the image, you can disable the title output by adding show_title="no". Here, we've also added the new feast-image-round class to the images, which display the images as a circle.
Another fun new image style we've added is the feast-image-pivot class, which displays the images slightly off-center.
By combining different styles, we can create entirely new and unique displays. The images for the pastries categories below are uploaded at full color, but displayed in a classical parisian monochrome-style and frame. By adding the feast-image-double-frame to the image and applying the feast-category-index-list-overlay class to the list, we create the effect below.
To be eligible for display, all the following criteria must be met:
- Category featured images must be enabled
- The category must have a category featured image assigned to it
- The category must have at least 1 post in it
- The slugs you specify must match an existing category
For more troubleshooting, see "Troubleshooting" below.
Using the simple_category_index shortcode without any parameters will display all your eligible category images and the category name, but you can customize the display with:
- categories="" - specify exactly which categories to display, using your category slugs - recommended
- show_title="off" - to disable the title output (for example, if the category name is in the image)
- list_class="feast-grid-third" - to change from the default one-fourth display. Available are displays are:
- feast-grid fifth
- These classes need to go after the feast-grid-X class, and only affect the desktop output:
- container_class="" - to add your own custom styling to the container with custom classes that you can define in "Additional CSS"
- image_class="feast-image-round" - to add classes to the images, for styling. New image classes we have built in include:
- feast-image-round for round images
- feast-image-border for a single border
- feast-image-double-border for a double border
- feast-image-pivot for an off-tilt image
- feast-image-casablanca for monochrome
Note: in all themes later than 4.0.8, anything larger than "full" is displayed as one-half on mobile for readability.
Adding category featured images
1. Enable the Category Featured Images
You have to enable the Category Featured Images in the Feast Plugin first.
2. Upload your Category Featured Images
Then upload the new category featured images in Media > Add New
Due to a weird bug in WordPress, old images may not have the appropriate meta-data, so you'll need to upload new images. That aside, we recommend intentionally building new category images so that they have a consistent look.
3. Set the Featured Category Image
You can then add them to your categories in Admin > Post > Categories
Tips for building category images
- Images should be 1000x1000 or larger
- Image names should follow good SEO practices: they should match the page content (be named after the category + word "recipes")
- Including the category name in the center of the image allows for flexibility in how it gets displayed, and allows for circle-styling
- Due to a weird bug in WordPress, all images for the category featured image must be new uploads
We're tracking this bug down, but it's likely due to a change in how WordPress handled image uploads in the past.
We aren't big fans of nested categories, and with the Simple Category Index you can create a visual hierarchy by grouping categories without actually requiring categories to be nested.
For example, you can have a category for seasonal recipes including "Winter", "Spring", "Summer" and "Fall" without having a useless "Seasonal" parent category by simply displaying these categories with a "Seasonal" header.
Image alt text
The image's alt text is generated from the category's name for accessibility and screen readers.
These are some sites that have category images.
Where can I use this?
All the places!
- It can be inserted into the homepage widget areas as "Custom HTML" widget
- It can be inserted into the "Primary Sidebar" widget area using the "Custom HTML" widget
- It can be added to the "Archive Intro Text" to display on category pages.
- It can be inserted directly into posts to link to all the categories the recipe is a part of
You may need to enable the Process Shortcodes on "Custom HTML" widgets feature:
One of my categories isn't showing
- If the shortcode doesn't find an exact match for your category slug, it will not show
- If the shortcode doesn't find a category featured image for the category, it will not show
- If your category has no posts in it, it will not show
We considered adding a placeholder image for all categories without images set, as well as displaying categories without posts, but decided that this would be a bad user experience for visitors.
It's important that you intentionally build these images, and categories, and optimize it for your readers so that you don't end up with thin-content garbage that you need to delete later on.
This has become especially prominent given that many sites being audited end up needing to delete poor quality content, and it drives up their ranking.
How can I prevent a category from showing?
The shortcode is built to be additive, instead of subtractive. That means if you want to exclude a category from showing, you should list the categories you want to show, instead of trying to remove specific categories.
The shortcode is designed to be used as a short, specific list rather than display-all. This is because most blogs have a huge number of unrelated categories and displaying all of them in a single place isn't a user-first experience.
The categories you display should be related to the content of the page you're on. If you're on a desserts page, showing categories related to desserts (pies, cakes, cookies) is a good idea. Showing unrelated categories (salads, smoothies, soups) is not.
Sidenote: not setting a category featured image will prevent that category from showing.
The parameters I'm setting aren't working
We've seen a few people report issues with not being able to change the layout. These have been tied to using incorrect quotations, which are caused by copying + pasting from a third-party application (such as Microsoft Word).
Make sure you're using proper single ( ' ) or double ( " ) quotation marks - not the slanted quotation marks that are used by word processors.
Separate mobile and desktop displays
The default grid columns (feast-grid-half, feast-grid-third, feast-grid-fourth) should be used to control the mobile layout. We live in a mobile-first world - design for mobile.
You can use the separate desktop classes to change how the grids are displayed on desktop: feast-desktop-grid-half, feast-desktop-grid-third, feast-desktop-grid-fourth, feast-desktop-grid-fifth, feast-desktop-grid-sixth
Ideally, you'll want to use a mobile grid that divides evenly into desktop - the two primary would be:
- feast-grid-half with feast-desktop-grid-fourth
- feast-grid-third with feast-desktop-grid-sixth
Seasoned Pro and Cravings Pro
This is a completely new, better method than what was built into Seasoned Pro and Cravings Pro years ago. We recommend implementing the Simple Recipe Index and removing the Seasoned Pro and Cravings Pro method. To remove the theme setup:
- Remove the "Featured Page" widgets from the "Recipes Bottom" widget area in Admin > Appearances > Widgets
- Delete the pages you've created from Admin > Pages
- Remove any redirects you have in place for those pages
We'll introduce two more guides for how to best use this in your categories, as well as your posts. There should be a few more built-in styles available over the next couple weeks.
Currently, categories are displayed in alphabetical order by WordPress, regardless of the order you specify them in. We're looking into setting them to display in the order you specify them.