WordPress.org

Ready to get started?Download WordPress

Forums

Customizr
How to add custom sidebars to different pages (1 post)

  1. Seahawksean
    Member
    Posted 11 months ago #

    I'm trying to add a customer slider to my about page using a custom template. I looked thru the entire forum for this answer but there was nothing. I'm made custom sidebars for other themes with no problem but for some reason can't figure it out in Customizr. There are far too many ways to make custom sidebars. I tried a few but none have worked.

    Link to my about page: http://www.biologydesign.com/websites/about-us/

    I've created a custom template from for my about page and named it about-page.php and place it in my child theme. I replaced do_action( '__sidebar' , 'left' ); with do_action( '__sidebar' , 'about' );.

    I copied the sidebar-left.php file to my child theme and renamed it to sidebar-about.php. I changed the code so it looks like this:

    <?php if ( is_active_sidebar('sidebar-about') ) : ?>
    
    	<div id="left" class="widget-area" role="complementary">
    
    		<?php do_action( 'tc_top_left_sidebar' ); ?>
    
    		<aside class="social-block widget widget_social">
    
    			<?php do_action( '__social' , 'tc_social_in_left-sidebar' ); ?>
    
    		</aside>
    
    		<?php dynamic_sidebar('sidebar-about'); ?>
    
    		<?php do_action( 'tc_bottom_left_sidebar' ); ?>
    
    	</div><!-- #secondary -->
    
    <?php endif; ?>

    In my functions.php file I added the following to register the sidebar as usual:

    if ( function_exists('register_sidebar') ) {
    register_sidebar(array(
    'name' => 'About Left Sidebar',
    'id' => 'sidebar-about',
    'description' => 'Appears as the sidebar on the about page',
    'before_widget' => '<div style="height: 280px"></div><li id="%1$s" class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h2 class="widget-title">',
    'after_title' => '</h2>',
    ));
    }

    The new About Left Sidebar does appear as it should when I go to Appearance > Widgets.

    However, when I go to my About-Us page, it's still displaying the default left sidebar.

    What am I missing. It's probably something simple but my brain has melted after a month of sleepless nights looking at the code.

    Any help to get me in the right direction again would be greatly appreciated.

Reply

You must log in to post.

About this Theme

About this Topic