register_sidebar and white screen error

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.

Read More

What’s the problem?

Related posts

Leave a Reply

2 comments

  1. 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 tag

    Also, remove the include() part, it is not necessary

  2. Just put this code in function.php you will get left sidebar.

    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' );