Default Wordpress Widgets

Ive created a wordpress theme and when I submitted it to my directory I was told that I need to have some default widgets. I've been trying to figure out how to do this but can't find anything about it.

Please, help.


source to share

2 answers

Just use the * the_widget () * function:

if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() && !is_active_sidebar( 'your-example-widget-area' ) ) {
echo '<div>';
            'title'     => 'example title'
            ,'text'     => '
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
                    Aenean et quam a ante sodales feugiat. Aliquam et vulputate turpis. 
                    Mauris quis sodales neque. Sed vestibulum faucibus eros nec tincidunt. 
                    Integer tortor magna, suscipit vitae ultricies vel, vehicula sit amet sapien. 
            ,'filter'   => ''
            'before_widget' => '<div class="widget-container">'
            ,'after_widget' => '</div>'
            ,'before_title' => '<h3 class="widget-title">'
            ,'after_title'  => '</h3>'
echo '</div>'; } elseif( is_active_sidebar( 'your-example-widget-area' ) ) {
echo '<div>';
    dynamic_sidebar( 'your-example-widget-area' );  
echo '</div>';     } // endif;


Hope it helps. (Sry, for a weird} elseif position. Formatting is getting wrong at this point.)



Not hard to find Wordpress :)

Widgeizing Themes

API Widgets

How to create widgets



All Articles