I just need to check, if sidebar has any content

My functions.phpcode is below.

function aspirationas_extra_widget_1_init() {

    'name' => __('Extra Widget 1', 'aspirations'),
    'id' => 'extra_widget_1',
    'description' => __('Widgets for Extra 1', 'aspirations'),
    'before_widget' => '<aside>',
    'after_widget' => '</aside>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',

add_action('widgets_init', 'aspirationas_extra_widget_1_init');

And I read this widget by this code below.


I am beginner in wordpress development. I know this is a sili question, but I can not solved it. any one help me please.

1 Answer 1


Problem solved by this code below:

<?php if (is_active_sidebar('extra_widget_1')) {
          <?php dynamic_sidebar('extra_widget_1'); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.