• Resolved cs-web

    (@cs-web)


    Hello,
    I have installed your great plugin. But now I have a problem with my if-query in my theme (code see below)
    If I have assigned a widget to the area and activate it on one page, on the other pages the else-clause not working.

    Can you help?

    Thanks.

    <?php if ( is_active_sidebar( 'slider-widget-area' ) ) : ?>
                        <?php dynamic_sidebar( 'slider-widget-area' ); ?>
    
                            <?php else : ?>
                                    <img src="<?php header_image(); ?>" width="100%" height="auto" alt="" />
    
                                    <?php endif; ?>

    https://wordpress.org/plugins/widget-options/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi,

    Congratulations for choosing this plugin and thanks a lot for using it. Regarding your concern is_active_sidebar() is checking if there is a widget inside the sidebar which in that case there is so the else function will not be called. You can use the script below instead of that one, just make sure to change “slider-widget-area” to the right one. Let me know how it goes. Thanks!

    <?php if ( is_active_sidebar( 'slider-widget-area' ) ){
    	dynamic_sidebar( 'slider-widget-area' );
    } ?>
    <img src="<?php header_image(); ?>" class="sidebar-placeholder" style="display:none;" width="100%" height="auto" alt="" />
    <script type="text/javascript">
    	$(document).ready(function(){
    		if( $('.slider-widget-area').height() < 10 ){
    			$('.sidebar-placeholder').show();
    		}
    	});
    </script>

    Cheers,
    phpbits

    Thread Starter cs-web

    (@cs-web)

    Hi,
    I have used your code, but it doesn’t works. It is the same problem. The Slider will display, but the exceptions not.

    But with the old plugin “Display widgets” my code works.

    Cheers,

    Hi,

    Can you post your website link? Thanks!

    Cheers,
    phpbits

    Thread Starter cs-web

    (@cs-web)

    Hi,
    can I send you the Link via Mail? It’s not a public project 😉

    Thread Starter cs-web

    (@cs-web)

    Hi phpbits,
    With the Safari Developer Plugin I get this Error:

    TypeError: $ is not a function. (In ‘$(document)’, ‘$’ is undefined)
    (anonyme Funktion)ueber-uns:57

    <script type="text/javascript">
                    $(document).ready(function() {
                        if ($('.slider').height() < 10) {
                            $('.sidebar-placeholder').show();
                        }
                    });
    
                </script>

    Hi,

    Not sure why I didn’t get email notification when you replied. I hope it’s not too late to solve the issue. You can use this one to fix the $ issue :

    <script type="text/javascript">
                    jQuery(document).ready(function() {
                        if ( jQuery('.slider').height() < 10) {
                            jQuery('.sidebar-placeholder').show();
                        }
                    });
    
                </script>

    Let me know how it goes. Thanks!

    Cheers,
    phpbits

    Thread Starter cs-web

    (@cs-web)

    Hi,
    no problem. I don’t get a error message, but I get the widget content and in additional the alternative header picture.
    I want use the meta-slider for special pages. For other I want set up an costumer header.

    With the old plugin the php if-clause works fine. (display-widgets) 🙁

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Problem with is_active_sidebar Query’ is closed to new replies.