I have an issue wherein i have a plugin (newsletter) which has a widget whereby users can (usually) subscribe to a newsletter and other functionality.

But i digress.

I have been trying to create my own wordpress template solely for personal-use. The following is the code I've accumulated in progression to having a functional sidebar, but so far, un-successful. Any help is much appreciated. Thanks


<div id="content" class="alignCenter">  
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>  
    <?php the_content(); ?>  
    <?php endwhile; endif; ?> 

<?php get_sidebar(); ?>


<?php /**  * Register our sidebars and widgetized areas.  *  */
 function arphabet_widgets_init() {

    register_sidebar( array(        'name' => 'Home right sidebar',         'id' =>

    'before_widget' => '<div>',
        'after_widget' => '</div>',
        'before_title' => '<h2 class="rounded">',
        'after_title' => '</h2>',
    ) );
    add_action( 'widgets_init', 'arphabet_widgets_init' );

Sidebar.php (taken from twentyfourtine theme )

 * The Sidebar containing the main widget area
 * @package WordPress
 * @subpackage Twenty_Fourteen
 * @since Twenty Fourteen 1.0
<div id="secondary">
        $description = get_bloginfo( 'description', 'display' );
        if ( ! empty ( $description ) ) :
    <h2 class="site-description"><?php echo esc_html( $description ); ?></h2>
    <?php endif; ?>

    <?php if ( has_nav_menu( 'secondary' ) ) : ?>
    <nav role="navigation" class="navigation site-navigation secondary-navigation">
        <?php wp_nav_menu( array( 'theme_location' => 'secondary' ) ); ?>
    <?php endif; ?>

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

When you use is_active_sidebar and dynamic_sidebar the argument needs to match the id of a registered sidebar in your theme. In your case that is going to be home_right_1 not sidebar-1 as in the code you copied.

Technically, the sidebar name should also work in both and the sidebar index number should work with is_active_sidebar but I vaguely recall having trouble getting the name to work correctly, so be aware.

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.