• Hi Have added custom sidebars to custom templates, they show in admin but do not appear on the pages
    have added to functon.php (adult theme)

    register_sidebar( array(
    		'name' => __( 'Members Sidebar', 'twentytwelve' ),
    		'id' => 'sidebar-members',
    		'description' => __( 'Appears on members pages', 'twentytwelve' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => '</aside>',
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );

    side bar code

    <?php
    /**
     * The sidebar containing the main widget area
     *
     * If no active widgets are in the sidebar, hide it completely.
     *
     * @package WordPress
     * @subpackage Twenty_Twelve
     * @since Twenty Twelve 1.0
     */
    ?>
    
    	<?php if ( is_active_sidebar( 'sidebar-members' ) ) : ?>
    	<div id="sidebar" class="widget-area" role="complementary">
    		<?php dynamic_sidebar( 'sidebar-members' ); ?>
    	</div><!-- .extra-sidebar .widget-area -->
    <?php endif; // end extra sidebar widget area ?>

    template call code

    <?php get_sidebar('sidebar-members'); ?>

    the sidebars appear in admin/backdoor but not on the page, not ven in the source code
    site – https://clivemabey.me.uk/Seals/members/
    thankyou – can anyone help???
    melanie

Viewing 7 replies - 1 through 7 (of 7 total)
  • When you call get_sidebar( 'sidebar-members' ), WordPress looks for a file named sidebar-sidebar-members.php, which probably isn’t what you want. Instead, to actually call in a sidebar, you should call dynamic_sidebar( 'sidebar-members' ), which you already do in sidebar.php. So try calling get_sidebar() without any arguments.

    Thread Starter melanie bund

    (@melanie-bund)

    thanks alot that really helped side bar appears on page but below content for some reason but that may be a css problem, what is ODD is that it replicates the main menu plus the custom sidebar menu???
    https://clivemabey.me.uk/Seals/members/
    The custom menu is from “GREY SEAL INFO to CONSTITUTION AND COMMITTEE” and the main menu seems to be wrapped around it???
    thanks
    HELP
    melanie

    I don’t see the text “GREY SEAL INFO” or “CONSTITUTION AND COMMITTEE” on the page you linked. Can you verify that you’ve linked the correct page?

    Thread Starter melanie bund

    (@melanie-bund)

    yes the sidebar is on the right underneath the content and when i view on firefox the main menu repeats and the custom menu is no where in sight

    Are you using the Custom Menu widget to display the menu in your custom sidebar? If so, can you verify that the correct menu is selected for that widget?

    the theme assumes that the page used (the ‘members.php’ page template) is ‘full width’ (there is a corresponding CSS class added via the body_class()) as you possibly have not added the necessary adjustments to the custom body_class code in functions.php of your child theme.

    check the corrresponding code in functions.php of the parent theme:

    function twentytwelve_body_class( $classes ) {
    	$background_color = get_background_color();
    	$background_image = get_background_image();
    
    	if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'page-templates/full-width.php' ) )
    		$classes[] = 'full-width';
    
    ...etc...

    the above code is only checking if the ‘sidebar-1’ is active.

    a possible code to use in functions.php of the child theme is:

    add_action( 'after_setup_theme', 'twentytwelvechild_setup' );
    
    function twentytwelvechild_setup() {
    add_filter( 'body_class', 'twentytwelvechild_body_class' );
    }
    
    function twentytwelvechild_body_class( $classes ) {
    
    	if ( is_active_sidebar( 'sidebar-members' ) && is_page_template( 'members.php' ) ) {
          foreach($classes as $key => $value) {
          if ($value == 'full-width') unset($classes[$key]);
          }
        }
    	return $classes;
    }
    Thread Starter melanie bund

    (@melanie-bund)

    thank you so much stephen and alchymyth
    replicating the main menu in sidebar – only way i could solve is to have no widgets and register a second menu, when i add custom menu as widget i just get a copy of the main menu plus the custom menu for some reason.

    The code kindly given above does not seem to have any effect, so will ty and fiddle with the css and see if i can get it to work that way

    thank you again
    Melanie

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘twentytwelve custom sidebars not showing even in page source’ is closed to new replies.