Classifier Set Category Menu

Untitled

My friend Vitaly from Russia (the first one from Russian 🙂 ) asked me about a popular listing WordPress theme, Classifier. If you take a look the image above, you will see a lists of category displayed at the left side of the slider.

This section will displaying all ads category you have including the child, unfortunately this section will displaying all of them. Imagine if you have more than 30 categories, all of them will be displayed there at once and make your site looks ugly.

What Vitaly asked me is about how to set how many or can we set manually which category should be displayed there? The answer is yes! you can do it easily. At this post, i will tell you how to make it.

What you have to do is modifying a file name theme-functions.php and find out this code (you can find out this file by login into your FTP and go to directory: wp-content > themes > classifier > includes):

$taxonomy     = COLABS_TAX_CAT;
    $orderby      = 'name';
    $show_count   = 0;      // 1 for yes, 0 for no
    $pad_counts   = 0;      // 1 for yes, 0 for no
    $hierarchical = 1;      // 1 for yes, 0 for no
    $title        = '';
		$empty 				= 0;

    $args = array(
      'taxonomy'     => $taxonomy,
      'orderby'      => $orderby,
      'show_count'   => $show_count,
      'pad_counts'   => $pad_counts,
      'hierarchical' => $hierarchical,
      'title_li'     => $title,
      'hide_empty'   => $empty
    );

Edit that code become:

$taxonomy     = COLABS_TAX_CAT;
    $orderby      = 'name';
    $show_count   = 0;      // 1 for yes, 0 for no
    $pad_counts   = 0;      // 1 for yes, 0 for no
    $hierarchical = 1;      // 1 for yes, 0 for no
    $title        = '';
		$empty 				= 0;

    $args = array(
      'taxonomy'     => $taxonomy,
      'orderby'      => $orderby,
      'show_count'   => $show_count,
      'pad_counts'   => $pad_counts,
      'hierarchical' => $hierarchical,
      'title_li'     => $title,
      'hide_empty'   => $empty,
      'include' => array(8, 325)
    );

At the code above, i’m adding a new parameter for the array $args, it is include. With this parameter, you can tell WordPress directly which category you want to displaying at the category menu and the other will be hidden.

At the include parameter, you can see if i’m adding 2 values separated by a coma sign (8, 325). That number are the category ID i want to displaying.

If you don’t know yet how to find the ID, you can check this tutorial:

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s