WordPress theme creation : There are no widget areas on the page shown -
i new wordpress , creating theme scratch.
want create widget area, customize panel tells :
there no widget areas on page shown, other pages in theme have them
how guys create widget area ? please tell me need put in files ?
thank you
add code theme functions.php file.
add_action( 'widgets_init', 'theme_slug_widgets_init' ); function theme_slug_widgets_init() { register_sidebar( array( 'name' => __( 'main sidebar', 'theme-slug' ), 'id' => 'sidebar-1', 'description' => __( 'widgets in area shown on posts , pages.', 'theme-slug' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', ) ); }
instead of theme_slug_
should use own theme slug. can check page more information. https://codex.wordpress.org/function_reference/register_sidebar
Comments
Post a Comment