• Resolved Arnoud

    (@derice)


    I’m attempting to create a sidebar that shows some photographs taken at random from the Nextgen Gallery.

    When I load the NextGen Widget in the default sidebar it nicely shows some random images in de sidebar.

    When I create a custom sidebar, this sidebar drops below the posts.

    This is what I’ve done so far:

    In Functions.php:

    register_sidebar( array(
    		'name' => __( 'Photography Sidebar', 'twentytwelve' ),
    		'id' => 'sidebar-4',
    		'description' => __( 'Appears when using the optional Photography template with a page.', 'twentytwelve' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget' => '</aside>',
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );

    Created a new template file photo-page.php:

    <?php get_header(); ?>
    
    	<div id="primary" class="site-content">
    		<div id="content" role="main">
    
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', 'page' ); ?>
    				<?php comments_template( '', true ); ?>
    			<?php endwhile; // end of the loop. ?>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php dynamic_sidebar('sidebar-4'); ?>
    <?php get_footer(); ?>

    Nothing fancy, but I can’t seem to get the customsidebar to show up on the right hand side of the website. It drops to below the post.

    On the same page, the default sidebar displays nicely on the right hand side, the custom doesn’t. Only shows below the post.

    Again, in the default it works fine.
    But as soon as I used this custom sidebar it only shows up below the post. Even when I re-create the default sidebar in the custom one, it drops below the post.

    What am I missing here?

    I can’t provide a link as it is on an internal server.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Have you looked at the CSS for the custom page/sidebar? Is the regular being applied to the new one?

    Thread Starter Arnoud

    (@derice)

    Thanks for your reply. ??

    The photo-page.php is a copy of the default page.php file.
    The only thing I changed is:

    <?php get_sidebar(); ?>

    into:

    <?php dynamic_sidebar('sidebar-4'); ?>

    I can’t find any relation to “dynamic_sidebar” in the style.css file.

    I assume the CSS remains the same?

    Thread Starter Arnoud

    (@derice)

    Found it. ??

    I needed to copy the default sidebar-front.php to sidebar-photo.php

    Contents of Sidebar-photo.php:

    <?php if ( is_active_sidebar( 'sidebar-4' ) ) : ?>
    		<div id="secondary" class="widget-area" role="complementary">
    			<?php dynamic_sidebar( 'sidebar-4' ); ?>
    		</div><!-- #secondary -->
    	<?php endif; ?>

    And then change a line in photo-page.php:

    <?php dynamic_sidebar('sidebar-4'); ?>

    into:

    <?php get_sidebar( 'photo' ); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Theme: TwentyTwelve] Custom Sidebar drops below post’ is closed to new replies.