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.

+2


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>';
    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 it helps. (Sry, for a weird} elseif position. Formatting is getting wrong at this point.)

+1


source


Not hard to find Wordpress :)

Widgeizing Themes



API Widgets

How to create widgets

-3


source







All Articles