How To Exclude Posts Category from Homepage in Thesis Theme

Share this Article :

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.

Also Read :   How to Setup Secure SSH Without Password on Linux CentOS

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