Title: Responsive Test
Last modified: August 30, 2016

---

# Responsive Test

 *  Resolved [Mark Burgess](https://wordpress.org/support/users/markburgess/)
 * (@markburgess)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/responsive-test/)
 * What logic is needed to detect screen size and hide (or expose) a widget on mobile
   platforms? I tried
 * is_front_page() && screen.width >= 479
 * and
 * is_front_page() && $_POST[‘width’] > 479
 * and
 * is_front_page() && $_SESSION[‘screen_width’] > 479
 * but nothing worked.
 * [https://wordpress.org/plugins/widget-logic/](https://wordpress.org/plugins/widget-logic/)

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

 *  [alanft](https://wordpress.org/support/users/alanft/)
 * (@alanft)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/responsive-test/#post-6611420)
 * It’s not possible to do “responsive” layout widget logic, because logic is executed
   server-side, so it can’t respond to client-side layout/screen-size changes dynamically.
 * You could do the above by putting “is_front_page()” in your widget logic (to 
   put the widget in your front_page) then in your CSS you can hide it when the 
   width is 479px or less. Which would look something like…
 *     ```
       @media screen and (max-width: 479px)
       {
           #sidebar #get-recent-comments-or-whatever {display:none}
       }
       ```
   
 *  Thread Starter [Mark Burgess](https://wordpress.org/support/users/markburgess/)
 * (@markburgess)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/responsive-test/#post-6611421)
 * That works. Good thought. For a later version, you might consider incorporating
   an Ajax option that becomes available when the widget loads. Just a thought. 
   Thanks for the note.

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

The topic ‘Responsive Test’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/widget-logic_c8dde5.svg)
 * [Widget Logic](https://wordpress.org/plugins/widget-logic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/widget-logic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/widget-logic/)
 * [Active Topics](https://wordpress.org/support/plugin/widget-logic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/widget-logic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/widget-logic/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Mark Burgess](https://wordpress.org/support/users/markburgess/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/responsive-test/#post-6611421)
 * Status: resolved