WordPress Default Widgets

Ive created a wordpress theme and when I submitted it to their directory I was told I needed to have some default widgets. Ive been trying to find out how to do this but can’t find anything on the matter.

Please help.

Related posts

Leave a Reply

2 comments

  1. Just use *the_widget()* function:

    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() && !is_active_sidebar( 'your-example-widget-area' ) ) {
    echo '<div>';
        the_widget(
            'WP_Widget_Text'
            ,array(
                'title'     => 'example title'
                ,'text'     => '
                    <p>
                        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. 
                    </p>
                '
                ,'filter'   => ''
            )
            ,array(
                '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 that helps. (Sry, for the strange }elseif position. Formatting get’s wrong at the moment.)