How to make featured block on homepage category-specific

Hi dear people!

In BuddyPress Corporate, there's a neat colored featured block on the homepage. I'd like to add another one and make them both category specific. Most important question: how can i make 2 of those blocks appear on the home page? Which part of the code do i need to copy, and is there all there is to it?

And then, if you could, please tell me how i can make the blocks display only posts from a certain category. I realise the latter may be outside the scope of your services but any help would be greatly appreciated!!

Thanks a lot,


  • Philip John

    Hiya Juuth,

    To do this you'd need to open up home.php and look for the WordPress loop.

    You'll need to copy that to create a new, duplicate loop.

    Then, you'll need to change the parameters of the query in order to alter the categories that are displayed. These are done using the WP_Query parameters.

    This obviously requires coding so if you're not comfortable with development I would recommend hiring a developer. This is a small job for a competent one.


  • Juuth

    Hi Phil,

    Thank you for your answer!

    I am just starting to dig a bit deeper into wordpress myself and am very eager to learn. Would you be kind enough to tell me how to adjust the below code (home.php) to have the home page featured post column displayed twice? I have tried but i guess i'm overlooking a tiny thing and it's not working.

    <?php get_header(); ?>
    <div id="post-entry" class="home-column">

    $home_featured_block = get_option('tn_buddycorp_home_featured_block');
    $home_featured_block_style = get_option('tn_buddycorp_home_featured_block_style');

    <?php if($home_featured_block != 'hide') { ?>

    <?php if($home_featured_block_style != 'slideshow') { ?>

    <?php locate_template( array( 'lib/templates/wp-template/main-column.php'), true ); ?>

    <?php } else { ?>

    <?php } ?>

    <?php } ?>

    <?php if ( is_active_sidebar( __('left-column', TEMPLATE_DOMAIN ) ) ) : ?>
    <?php dynamic_sidebar( __('left-column', TEMPLATE_DOMAIN ) ); ?>
    <?php endif; ?>


    <?php locate_template( array( 'home-sidebar.php'), true ); ?>

    <?php get_footer(); ?>

    Thank you so very much for your help!!

    Kindest regards,


  • Philip John

    Ah, I forgot it's in a separate file.

    First, copy this line;
    <?php locate_template( array( 'lib/templates/wp-template/main-column.php'), true ); ?>

    ...and paste it before this line;
    <?php if ( is_active_sidebar( __('left-column', TEMPLATE_DOMAIN ) ) ) : ?>

    Then, you'll need to copy lib/templates/wp-template/main-column.php and rename it. Now change the line you pasted to use the new file name.

    Then, open up that new file. You'll need to change this line;
    $cat_query = new WP_Query('cat='. $home_featured_block_cat . '&' . 'showposts=' . $home_featured_block_count);

    Change it to this to make it import category ID 4;
    $cat_query = new WP_Query('cat=4&' . 'showposts=' . $home_featured_block_count);

    Hope that helps!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.