Knowledgebase

Ambition: How to Exclude Categories from Tab Navigation on Category Archives

Intro

Click on Posts > Categories and mouse-over each category link. In your browser’s status bar, you will see a URL similar to this: http://www.yoursite.com/wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=135&post_type=post Note the tag_ID number for each category you don’t want to show on the menu. Go to Appearance > Editor, click archive.php (Theme Archive). At the top is this array of […]

Solution

Click on Posts > Categories and mouse-over each category link. In your browser’s status bar, you will see a URL similar to this:

http://www.yoursite.com/wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=135&post_type=post

Note the tag_ID number for each category you don’t want to show on the menu.

Go to Appearance > Editor, click archive.php (Theme Archive). At the top is this array of options:

<?php $tabcats = array(
    'show_option_all'    => '',
    'orderby'            => 'name',
    'order'              => 'ASC',
    'style'              => 'list',
    'show_count'         => 0,
    'hide_empty'         => 1,
    'use_desc_for_title' => 1,
    'child_of'           => 0,
    'feed'               => '',
    'feed_type'          => '',
    'feed_image'         => '',
    'exclude'            => '|',
    'exclude_tree'       =>' ',
    'include'            =>' ',
    'hierarchical'       => true,
    'title_li'           => __( ' ),
    'show_option_none'   => __('),
    'number'             => null,
    'echo'               => 1,
    'depth'              => 1

); ?>

Place your cursor between the two single-quotes in the ‘exclude’ option and enter the tag_ID numbers, separated by commas. For example:

   'exclude'            => '156, 44',

Click Update File. You should now only see the categories you want in the menu on all archive pages for Standard Posts.

Get 15% off!

Signup and get 15% off any of our Ghost or Framer themes immediately