WordPress.org

Ready to get started?Download WordPress

Forums

Customizr
Different menus for different (groups of) pages (6 posts)

  1. Cooperdale
    Member
    Posted 1 year ago #

    Hello, it's me again. I'm embarking on building a VERY complex WordPress site, and I want to use Customizr to do it because of the css option it offers.

    I was wondering, what would be the best way to have different menus on the left sidebar, depending on the page? Customizr is different from most themes I've used, so I am not 100% sure how to do this.

    I need particular menus for particular groups of pages, so I guess templates would be the way to go.

  2. Cooperdale
    Member
    Posted 1 year ago #

    To make myself clearer, I created a menu with WP and I want to use it in one or more pages, on the left sidebar.

    I created a custom sidebar in my child-theme, adding this code to functions.php:

    if ( function_exists('register_sidebar') ) {
    register_sidebar(array(
    'name' => 'Paesi Sidebar',
    'id' => 'paesi-sidebar',
    'description' => 'Paesi',
    'before_widget' => '<aside id="%1$s" class="widget %2$s">' ,
    'after_widget' => '</aside>' ,
    'before_title' => '<h3 class="widget-title">' ,
    'after_title' => '</h3>' ,
    ));
    }

    Then I created a new template paesi.php with this code in it:

    <?php
    /*
    Template Name: Paesi
    */
    
    get_header();
        do_action( '__fp_block' );
        do_action( '__breadcrumb' );
          ?>
            <div class="container" role="main">
                <div class="row">
                    <?php
                        do_action( '__sidebar' , 'paesi-sidebar' );
    			        	do_action( '__loop' );
                        do_action( '__sidebar' , 'right' );
                    ?>
                </div><!--#row -->
            </div><!-- #container -->
        <?php
    get_footer();
    ?>

    and a sidebar-paesi.php file with this code:

    <?php
    /**
     * The sidebar containing the left widget area for Paesi template.
     *
     */
    ?>
    <?php if ( is_active_sidebar( 'paesi-sidebar' ) ) : ?>
    
    	<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( 'paesi-sidebar' ); ?>
    
    		<?php do_action( 'tc_bottom_left_sidebar' ); ?>
    
    	</div><!-- #secondary -->
    
    <?php endif; ?>

    The sidebar is there in the Widgets page, and I added the custom menu to it: I thought all this would suffice, but the sidebar doesn't show up at all...

  3. Seahawksean
    Member
    Posted 11 months ago #

    @Cooperdale,

    Did you ever find a solution to this? I too am wanting different sidebars on different pages. I did exactly what you did, have the widget in my widgets editor, but it doesn't show up on the page I created the custom template for.

    Thanx

  4. Tasha
    Member
    Posted 11 months ago #

    I use a plug-in called Custom sidebars that worked really well with Customizr.

  5. Cooperdale
    Member
    Posted 11 months ago #

    Actually, I changed my theme and solved the problem that way...

  6. acub
    Member
    Posted 11 months ago #

    You only need to register new sidebars if you want to place additional sidebars in your page, in other places, while keeping the ones that are already registered.

    Changing content of sidebars relative to the page you're on is called Widget Logic and should be handled by plugins, not by themes. The most popular widget logic plugin for WP is called... Widget Logic.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic