Archived topic
How to disable footer widgets only in mobile?
7 replies · Started by Kirsi on February 12, 2018
Hi
I`m using GP Premium anf Elementor Basic. I can not find the way how to disable my 3 footer widgets on mobile view. On desktop and on tablet they are ok but, mobile looks horrible and I want them no to be shown.
Thank you so much in advance :)
Hi there,
Try this CSS:
@media (max-width: 768px) {
.footer-widgets {
display: none;
}
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
Yes, it worked!
Thank you for your quick reply :)
No problem :)
Can we also disable the footer bar in mobile? Basically removing the entire footer (widgets and bar) on mobile.
How about for logged in users only?
Hi there,
you can try this function it will unhook footer widgets and footer bar if a user is logged in on a mobile device:
add_action( 'wp', function() {
if ( wp_is_mobile() && is_user_logged_in() ) {
remove_action( 'generate_footer', 'generate_construct_footer_widgets', 5 );
remove_action( 'generate_footer', 'generate_construct_footer', 10 );
}
} );
Note: wp_is_mobile() conditional tag applies to a device being detected, so simply shrinking your desktop web browser does not apply.
awesome! thank you :)
You're welcome