• Resolved krishnaTORQUE

    (@krishnatorque)


    function.php

    <?php
    
    $sidebar=array(
    	'name' => 'sidebar',
    	'id' => 'sidebar',
    	'description' => __('sidebar'),
    	'before_widget' => '<div>',
    	'after_widget' => '</div>'
    );
    if ( function_exists('register_sidebar') ) register_sidebar($sidebar);
    
    ?>

    sidebar.php

    <?php dynamic_sidebar(‘sidebar’);?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • you’ve not initialized the function well. well you can use the code below:

    if(!function_exists('my_theme_sidebar')){
    function my_theme_sidebar(){
    $sidebar=array(
    	'name' => 'sidebar',
    	'id' => 'sidebar',
    	'description' => __('sidebar'),
    	'before_widget' => '<div>',
    	'after_widget' => '</div>'
    );
    if ( function_exists('register_sidebar') ) register_sidebar($sidebar);
    }
    add_action('widgets_init','my_theme_sidebar');
    }

    Hope it would solve your problem

    Thread Starter krishnaTORQUE

    (@krishnatorque)

    Sorry function.php is not correct. It have to be functions.php

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘register sidebar function is not working’ is closed to new replies.