The sticky header is a cool feature we all love :). Though we might find it useful just in desktop browsers and we would like to keep the static header in mobiles.
Here’s a simple snippet to add to your child-theme functions.php in order to achieve that.
add_filter('tc_opt_tc_sticky_header', 'disable_sticky_in_mobiles'); function disable_sticky_in_mobiles( $bool ){ return $bool && ! wp_is_mobile(); }
This snippet just uses one of the large amount of the filters Customizr and Customizr-Pro provide plus a Wordpress’ built-in function which checks whether or not you’re visiting the site on a mobile device (tablet included).
Where to copy/paste this code?
Add it to your child-theme functions.php.
Everything you need to know about creating a child theme with Customizr here.
Goodbye and goodluck
5 thoughts on “Disable Customizr(-Pro) sticky header in mobiles”
I like this idea as on mobile devices the slider seems to get smashed under the header when sticky header is turned on. Is there a way to cause a sticky floating menu icon on scroll, and get rid of the rest of the sticky header?
Hi,
The developer team handles support for Customizr at https://wordpress.org/support/theme/customizr and for Customizr-Pro at http://presscustomizr.com/support/. Please post your query there with a link to your site.
Is there a way to do the “reverse” of this? I.e. only have the (IMO much neater looking) smaller sticky header “always on” when viewing on mobile (not desktop) so that it does not switch back and forward between two sizes? For clarity – I only mean this for mobile viewing – not desktop.
Hi,
This is an enhancement which the team is working on. Check the progress here.
https://github.com/presscustomizr/customizr/issues/492
Thank you! I will keep an eye on it.