Disable Customizr(-Pro) sticky header in mobiles

⚠️ Code snippets might not be compatible with the latest version of your theme. Always use a child theme to customize your theme, and test your code on a staging website before migrating to production.

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

Leave a comment

Your email address will not be published. Required fields are marked *

5 thoughts on “Disable Customizr(-Pro) sticky header in mobiles”