0

I'm building a custom theme. My sidebar is not being generated at all.

In functions.php, I have:

if ( function_exists('register_sidebar') ) {
    register_sidebar(array(
        'name' => 'Standard Sidebar',
        'id' => 'sidebar-1',
        'description' => 'Appears as the sidebar on standard pages',
        'before_widget' => '<li id="%1$s" class="widget %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h2 class="widgettitle">',
        'after_title' => '</h2>',
    ));
}

In sidebar.php, I have:

<?php echo '<div>You made it into the sidebar function</div>'; ?>
<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
    <div id="sidebar" class="widget-area" role="complementary">
        <?php dynamic_sidebar( 'sidebar-1' ); ?>
    </div><!-- #sidebar -->
<?php endif; ?>

In page.php, I have:

<?php
/**
 * Page
 */

get_header();

?>
<?php while ( have_posts() ) : the_post(); ?>

<div class="breadcrumbs_container">
    <div class="breadcrumbs">
        <?php if ( function_exists('yoast_breadcrumb') ) {
            yoast_breadcrumb('<p id="breadcrumbs">','</p>');
        } ?>
    </div>
<div>

<div class="container">
    <div class="content_container">
        <div class="page">
            <h1><?php the_title(); ?></h1>
            <div class="content">
                <?php the_content(); ?>
            </div>
        </div>
        <?php get_sidebar; ?>
    </div>
</div>

<?php endwhile; ?>

<?php get_footer(); ?>

I don't see "You made it into the sidebar function", and nothing appears in the source code of the page I am displaying.

It is a normal Wordpress page, and I have no custom templates created yet, so it should be using page.php.

1

Your get_sidebar call:

<?php get_sidebar; ?>

is missing the parentheses:

<?php get_sidebar(); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.