Created
September 3, 2024 11:14
-
-
Save Zodiac1978/43884c931472b6c337f307cc5db76dad to your computer and use it in GitHub Desktop.
Modify the meta viewport setting in the Divi theme
This file contains 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
<?php | |
// Source: https://divi.help/threads/the-user-scalable-no-attribute-is-used-in-the-meta-name-viewport-element-or-the-maximum-sc.10458/ | |
/** | |
* Remove the default viewport meta from Divi. | |
*/ | |
function db_remove_et_viewport_meta() { | |
remove_action( 'wp_head', 'et_add_viewport_meta' ); | |
} | |
add_action( 'after_setup_theme', 'db_remove_et_viewport_meta' ); | |
/** | |
* Add new viewport meta line to head. | |
*/ | |
function db_enable_pinch_zoom() { | |
echo '<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, minimum-scale=0.1, maximum-scale=10.0">'; | |
} | |
add_action( 'wp_head', 'db_enable_pinch_zoom' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment