I need to register a sidebar for a theme.
I’ve added this code to end of functions.php
<?php
include("widget.php");
function farad_widgets_init(){
register_sidebar(array(
'id' => 'sidebar-1',
'name' => 'left-sidebar',
'description' => 'farad' ,
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'farad_widgets_init' );
?>
After I’ve added the code, wp-login.php show me a white screen.
What’s the problem?
Remove the opening and closing php (
<?php ?>
) tags. You have most probably not closed your php tag after the last function, so adding your code as is, you creating a syntax error as you have an opening php tag within an already open php tagAlso, remove the
include()
part, it is not necessaryJust put this code in function.php you will get left sidebar.