How To Exclude Posts Category from Homepage in Thesis Theme

Lets say you have any post categories that you don’t want to showing up on your wordpress blog homepage together with all your other latest posts. There is the steps to do this on your wordpress blog that using thesis theme. If you are using wordpress 2.5 and above, you won’t be able to see the entry IDs on admin pages. However you can install the Reveal IDs plugin and activate it.

1. Assume that you have installed Reveal IDs plugin and able to see your category IDs on WordPress Thesis theme. For example, we will use entry ID 161 and 159.
2. In Dashboard admin –> go to Appearance –> Editor –> Select custom_functions.php.

    Note : Please make sure you have select theme to edit : thesis
    

Add below code at the bottom of custom_functions.php. Click update file to finish.

    /* Exclude Posts categories on the homepage */
    function home_filter_begin() {
    if(is_home()):
    global $wp_query;
    /* Exclude id 161 and 159 from homepage*/
    $exclude = '-161,-159';
    query_posts(array_merge(array('cat' => $exclude ),$wp_query->query));
    endif;
    }
    add_action('thesis_hook_before_content','home_filter_begin');
    
    function home_filter_end() {
    if(is_home()):
    wp_reset_query();
    
    endif;
    }
    add_action('thesis_hook_after_content','home_filter_end');
    
Leave a Reply

Your email address will not be published. Required fields are marked *

SiteGround.com

A world leading hosting company that provides fully-managed innovative and secure solutions, suitable for hosting small to medium-sized websites

Built on the best available technologies combined with Google Cloud for strong redundancy and application availability. Backed by skilled experts to address web security threats, a devops team to create advanced custom security solutions, and 24/7 sysadmins to watch over the platform. This powerful, hands-on approach makes your sites faster, safer, and easier to manage. Starting from only $3.95/mo.

TRY FREE

* up to 30 days money back guarantee