WordPress Widget “is_active_sidebar” always returns true

I want to create a facebook-like-box widget in wordpress:

<div class="widget-content">
            <div class="fb-like-box" 
                data-href="<?php echo $fbpageurl; ?>" 
                data-width="260" 
                data-colorscheme="<?php if ( is_active_sidebar('sidebar-1') ) { echo "light"; } else { echo "dark"; } ?>"
                data-show-faces="true" 
                data-header="false" 
                data-stream="false" 
                data-show-border="false"
            ></div>
        </div>

other file:

Read More
register_sidebar( array(
            // [...]
            'id' => 'sidebar-1',
            // [...]
    ) );

If I use the widget, it always return the “true” value… I don’t know why. My other sidebar names are “sidebar-2”, “sidebar-3″…

Related posts

Leave a Reply

2 comments

  1. is_active_sidebar returns true if any widget is active inside of sidebar even if sidebar isn’t shown on that page.

    I can see that your trying to change color but I can’t seem to figure out how and why. Maybe some more info would help figuring the solution to your problem.

    is_active_sidebar