• Hi, I’m using the hybrid news child theme of the hybrid framework. I want to have different sidebars according to category pages, like if I go to http://www.swarfblog.com/new/category/swarfblog/ it should have a different sidebar and a different one if I go to the frontpage or to another category. I tried to make page templates, they are showing in the template dropdown and use it but the page where I applied that template is not showing the way it should, instead its still using the default blog template. I also tried to use the is_category in my category template but still, its not showing up the sidebars that I have set on the categories. The new sidebar widgets have all been registered and are showing up in the widgets section. I have attached my category.php code below:

    <?php
    /**
     * Category Template
     *
     * This template is loaded when viewing a category archive.
     * It shows the category's description and latest posts.
     * @link http://codex.ww.wp.xz.cn/Category_Templates
     *
     * @package Hybrid
     * @subpackage Template
     */
    
    get_header(); ?>
    
    	<div class="hfeed content">
    
    		<?php hybrid_before_content(); // Before content hook ?>
    
    		<div class="category-info">
    
    			<h1 class="category-title"><?php single_cat_title(); ?></h1>
    
    			<div class="category-description">
    				<?php echo category_description(); ?>
    			</div><!-- .category-description -->
    
    		</div><!-- .category-info -->
    
    		<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    			<div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
    
    				<?php // get_the_image( array( 'custom_key' => array( 'Thumbnail' ), 'default_size' => 'thumbnail' ) ); ?>
    
    				<?php hybrid_before_entry(); // Before entry hook ?>
    
    				<div class="entry-summary entry">
    					<?php the_content(); ?>
    				</div><!-- .entry-summary -->
    
    				<?php hybrid_after_entry(); // After entry hook ?>
    
    			</div><!-- .hentry .post -->
    
    			<?php endwhile; ?>
    
    		<?php else: ?>
    
    			<p class="no-data">
    				<?php printf( __('Sorry, there are no posts in the %1$s category.', 'hybrid'), single_cat_title( false, false ) ); ?>
    			</p><!-- .no-data -->
    
    		<?php endif; ?>
    			<div id="widget-container">
                    <div id="primary" class="aside">
    
    					<?php
                        if ( is_category('100') ) {
                        include 'sidebar_shopdoc.php';
                        } elseif ( is_category('101') ) {
                        include 'sidebar_swarf.php';
                        } elseif ( is_category('107') ) {
                        include 'sidebar_magazine.php';
                        } elseif ( is_category('101') ) {
                        include 'sidebar_puzzles.php';
                        }
                        ?>
                    </div>
                </div>
    
    	</div><!-- .content .hfeed -->
    </div>
    <?php get_footer(); ?>

The topic ‘different sidebars per category’ is closed to new replies.