I’m getting a error500 on my page tolkeuddannelsen.dk. Through the error log I can se that its line 93-185 in my themes function.php that is causing the trouble. This is what my webhost says:
Backend fatal error: PHP Fatal error: Cannot redeclare thim_widgets_inits() (previously declared in /var/www/www.tolkeuddannelsen.dk/www/functions.php:93) in /var/www/www.tolkeuddannelsen.dk/www/wp-content/themes/elearningwp/functions.php on line 185n, referer: http://tolkeuddannelsen.dk/

The code in these lines looks like this.

function thim_widgets_inits() {
    register_sidebar( array(
        'name'          => __( 'Sidebar 1', 'thim' ),
        'id'            => 'sidebar-1',
        'description'   => 'Left Sidebar',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h4 class="widget-title">',
        'after_title'   => '</h4>',
    ) );

//  register_sidebar( array(
//      'name'          => __( 'Sidebar 2', 'thim' ),
//      'id'            => 'sidebar-2',
//      'description'   => 'Right Sidebar',
//      'before_widget' => '<aside id="%1$s" class="widget %2$s">',
//      'after_widget'  => '</aside>',
//      'before_title'  => '<h4 class="widget-title">',
//      'after_title'   => '</h4>',
//  ) );

    register_sidebar( array(
        'name'          => 'Top Drawer',
        'id'            => 'drawer_top',
        'description'   => __( 'Drawer Top', 'thim' ),
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h4 class="widget-title">',
        'after_title'   => '</h4>',
    ) );
    register_sidebar( array(
        'name'          => __( 'Offcanvas', 'thim' ),
        'id'            => 'offcanvas_sidebar',
        'description'   => 'Drawer Right',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h4 class="widget-title">',
        'after_title'   => '</h4>',
    ) );

    register_sidebar( array(
        'name'          => 'Menu Right',
        'id'            => 'menu_right',
        'description'   => __( 'Menu Right', 'thim' ),
        'before_widget' => '<li id="%1$s" class="widget %2$s">',
        'after_widget'  => '</li>',
        'before_title'  => '<h3>',
        'after_title'   => '</h3>',
    ) );
    register_sidebar( array(
        'name'          => 'Footer',
        'id'            => 'footer',
        'description'   => __( 'Footer Sidebar', 'thim' ),
        'before_widget' => '<aside id="%1$s" class="widget %2$s footer_widget">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h4 class="widget-title">',
        'after_title'   => '</h4>',
    ) );

    register_sidebar( array(
        'name'          => 'Copyright',
        'id'            => 'copyright',
        'description'   => __( 'Copyright', 'thim' ),
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h4 class="widget-title">',
        'after_title'   => '</h4>',
    ) );
    register_sidebar( array(
        'name'          => __( 'Sidebar Shop', 'thim' ),
        'id'            => 'shop',
        'description'   => 'Shop Sidebar',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h4 class="widget-title">',
        'after_title'   => '</h4>',
    ) );
    if ( class_exists( 'LearnPress' ) ) {
        register_sidebar( array(
            'name'          => 'Top Sidebar Courses',
            'id'            => 'top_sidebar_courses',
            'description'   => __( 'Top Sidebar Courses', 'thim' ),
            'before_widget' => '',
            'after_widget'  => '',
            'before_title'  => '<h3>',
            'after_title'   => '</h3>',
        ) );

        register_sidebar( array(
            'name'          => 'Sidebar Courses',
            'id'            => 'sidebar_courses',
            'description'   => __( 'Sidebar Courses', 'thim' ),
            'before_widget' => '<aside id="%1$s" class="widget %2$s">',
            'after_widget'  => '</aside>',
            'before_title'  => '<h4 class="widget-title">',
            'after_title'   => '</h4>',
        ) );
    }
}

Can anyone help me fix this problem? Thanks!

Read more here: error 500: PHP Fatal error: Cannot redeclare thim_widgets_inits()


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: