Hide a category in sidebar
-
I am using the blankslate template and would like to hide a category in my list in the sidebar.
I know you can hide it like this:
<?php wp_list_categories('exclude=8,8&title_li=') ?>
But i am confused how to integrate this into my widget sidebar as i have other widgets.
I hope this makes sense and any guidance would be great!
In this form the sidebar is displayed like this:
sidebar.php
<?php if ( is_active_sidebar('primary-widget-area') ) : ?> <div id="primary" class="widget-area"> <ul class="sid"> <?php dynamic_sidebar('primary-widget-area'); ?> </ul> </div> <?php endif; ?>
and the function for this is in the functions file: (here is a snippet of it)
functions.php
function blankslate_widgets_init() { register_sidebar( array ( 'name' => __('Sidebar Widget Area', 'blankslate'), 'id' => 'primary-widget-area', 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => "</li>", 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); } $preset_widgets = array ( 'primary-aside' => array( 'search', 'pages', 'categories', 'archives' ), ); function blankslate_get_page_number() { if (get_query_var('paged')) { print ' | ' . __( 'Page ' , 'blankslate') . get_query_var('paged'); } } function blankslate_catz($glue) { $current_cat = single_cat_title( '', false ); $separator = "\n"; $cats = explode( $separator, get_the_category_list($separator) ); foreach ( $cats as $i => $str ) { if ( strstr( $str, ">$current_cat<" ) ) { unset($cats[$i]); break; }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Hide a category in sidebar’ is closed to new replies.