I make a Wordpress theme from scratch and there is a problem - I can’t get the dynamic sidebar, help me solve the problem, please.

<div id="main-sidebar-wraper"> <?php if ( ! dynamic_sidebar( 'sidebar-devhelper' ) ) : ?> <?php endif; // end sidebar widget area ?> <aside> <?php get_search_form(); ?> </aside> <aside> <?php wp_get_archives('type=monthly&limit=12'); ?> </aside> </div> 

Static content is output, and dynamic content that I add to the wordpress console is not (((

UPD A widget block "sidebar-devhelper" appeared on the Wordpress admin page, on the widgets page, but when I add something to it, nothing is displayed at all !!

    1 answer 1

    To display it, you must first register it in the function.php file of your theme.

    For example:

     if ( function_exists('register_sidebar') ) { register_sidebar(array( 'name' => 'Left Sidebar', 'before_widget' => '<li id="%1$s" class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>', )); } 

    And then in the topic to call it:

     if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Left Sidebar') ) : ?> /* СЮДА все то, что должно выводиться если сайдбар не существует */ <?php endif; ?> 

    Look at the phpdesigner.in.ua wordpress section, something useful can