I have a function to create a wdiget area:

function restore_widgets_init() {
        register_sidebar( array(
            'name'          => 'Homepage Location',
            'id'            => 'arthurbob',
            'description'   => __( 'locations box on the homepage', 'restore' ),
            'before_widget' => '<div class="locataionHolder">',
            'after_widget'  => '<!--locationHolder--></div>',
            'before_title'  => '',
            'after_title'   => '',
        ) );

    add_action( 'widgets_init', 'restore_widgets_init' );

This shows up fine in the backend and I have added some widgets. But I can't get it to show up in the template file. I have this:

while ( have_posts() ) : the_post();
    // Include the page content template.
            get_template_part( 'template-parts/content_home', '' );
            // End of the loop.

    dynamic_sidebar( 'arthurbob');  

and I have also tried this:

if ( is_active_sidebar( 'arthurbob' ) ){
        echo '<p>arthurbob is active</p>'; 
     }else {
        echo '<p>arthurbob not active</p>';

and I get 'arthurbob not active'

Not sure what else to try.

  • 1
    something else is amiss. your code is ok, and should return "arthurbob is active". – yivi Jan 13 '17 at 13:05
  • Are you sure you've added widgets to the "Homepage Location" sidebar, in Appearance > Widgets – TheDeadMedic Jan 13 '17 at 13:49

Your Answer

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

Browse other questions tagged or ask your own question.