How to display multiple 'featured collections'

I’m trying to customize the Berlin theme (site here: by using “collections” to represent “categories,” and have them all appear on the homepage. currently the code only allows for one collection to appear at a time [random_featured_collection] but I would love to display all of them. doing something very wrong with the code here:

    $category = get_theme_option('Display Featured Collection');
    if ($category === null || $category === ''):
        $category = 3;
        $category = (int) $category;
    if ($category):
    <!-- Featured Collection -->
    <div id="featured-collection" class="featured">
        <h2><?php echo __('Categories'); ?></h2>
        <?php echo random_featured_collection($category); ?>
    </div><!-- end featured collection -->
    <?php endif; ?>

please help!

Hello Betty.

I’m not sure I’ve understood: do you want to show all categories at the same time, in the home page, even if that would (depending on the number of categories) require a lot of page space?
Or would you rather want to display one single random category, no matter whether it is featured or not?

As for the code you posted, I don’t think it will take you anywhere:

  • get_theme_option('Display Featured Collection') will return you a boolean value, so even if you assigned that value to a variable $category there would be no point in changing it to something (like 3 in your example);
  • random_featured_collection() function is not accepting any parameter, so no point in passing one (like $category in your example)

Hi Daniele!!

Yes I’m trying to show all the categories at the same time, there will only be 5 in total.

Thank you!!

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.