Flatsome Featured Items – Show Multiple Categories Of Related Featured Items

The WordPress Flatsome eCommerce theme has a really neat feature called Featured Items. Essentially, it's a custom post type you can use for … well, featuring stuff like portfolio items. Though there is one issue: it will only show related featured items from ONE category, which happens to be the first category it finds for that particular item.

What does this mean? It means if you have two Featured Item categories such as “Branding Projects” and “Web Development” and your item is in both, but since all branding projects and web dev projects are related to this Featured item it all should be shown right? Well, sadly not. It'll only show the related “Branding Projects”. Kind of a bummer there.

So, I've gone ahead and fixed that along with a logical fix / add-on. With the code below you'll be able to show off multiple categories for the Featured Items that have more than one category. Why only two or more items in the category restriction? Simple: if the category has only one item it's going to be this specific item only which mean's there's no point of showing it twice. We needed this for a client site that needed to show multiple categories for these items, and it works out well enough because each item would only have two categories (one unique, and one shared) so it ends up nicely showing as one row … yey!

There are limits to this code:

  • Since I only fixed up the existing code, it uses the featured_items_slider shortcode which means that if you have two (or more) active categories (each with two or more items in them) then you'll have multiple related item rows
  • To change the minimum count you'll have to go into the code to do that
  • It uses the shortcode so it's limited by the shortcode functionality (for example, I also wanted to cut out the second shared category from showing it's name. oh well)

Make a copy of the following file and place it into your child theme's folder. You'll want to replace this code at the bottom of “single-featured_item.php” around line 50 and below.

Just in case if you don't want to code, here's the complete file for you to downloaded (zipped for easy download):