Created
December 14, 2021 12:58
-
-
Save ahmedeshaan/a7412d0722de3cce42b7d47eb36f8420 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'after_setup_theme', 'definitely_allow_mobile_zooming_add_viewport'); | |
function definitely_allow_mobile_zooming_add_viewport() | |
{ | |
/* | |
* Set viewport for OceanWP | |
*/ | |
if ( class_exists('OCEANWP_Theme_Class') ) { | |
add_filter( 'ocean_meta_viewport', 'definitely_allow_mobile_zooming_oceanwp' ); | |
} | |
/* | |
* Set viewport by default | |
*/ | |
else { | |
add_action( 'wp_head', 'definitely_allow_mobile_zooming_default', 9999999 ); | |
} | |
} | |
function definitely_allow_mobile_zooming_default() { | |
print '<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, minimum-scale=0.1, maximum-scale=10.0">'; | |
print "\n"; | |
} | |
function definitely_allow_mobile_zooming_oceanwp( $viewport ) { | |
$viewport = '<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, minimum-scale=0.1, maximum-scale=10.0">'; | |
return $viewport; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment