• Hi,

    Responsive Preview on desktop, tablet and mobile is really cool feature of 4.5
    However it does not respond to wp_is_mobile(), which is useful for detect and customize the display of the page on desktop or mobile.
    For example in our case, we want to hide the sidebar on mobile view but display it on desktop view.

    Thanks,
    Maggy

Viewing 2 replies - 1 through 2 (of 2 total)
  • Maybe you can give the snippet on how did you use it?

    Thread Starter maggy821

    (@maggy821)

    Hi,

    Sorry for the late reply.
    Here is the code for showing/hiding sidebar:

    <?php if ( wp_is_mobile() ) { ?>
    <script>
    jQuery(“#primary”).css(“width”, “100%”);
    </script>
    <?php } else { ?>
    <?php if ( is_active_sidebar( ‘sidebar-1’ ) ) : ?>
    <div id=”secondary” class=”widget-area” role=”complementary”>
    <?php dynamic_sidebar( ‘sidebar-1’ ); ?>
    </div><!– #secondary –>
    <?php endif; ?>
    <?php } ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Responsive Preview does not respond to wp_is_mobile()’ is closed to new replies.