- This topic has 9 replies, 4 voices, and was last updated 3 years, 8 months ago by
Fernando.
-
AuthorPosts
-
August 19, 2020 at 8:46 am #1409767
Craig
Hi GP Support –
I am trying to prevent any zooming when a user clicks into a form field.
I’ve set up an element Hook (wp-head) and set it to Display Entire Site.
I’ve put this into the Hook:
<meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0″/>
Is this right/correct? Seems to work, just not sure if I am causing damage elsewhere?
Thanks so much!
August 19, 2020 at 1:13 pm #1410097Tom
Lead DeveloperLead DeveloperThat works, but it would be better to filter the one that GP adds so you don’t have both:
add_filter( 'generate_meta_viewport', function() { return '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0" />'; } );August 9, 2022 at 9:58 pm #2308455Justin
Hey, I have this same issue. But when I add it as a sitewide hook, the hook text displays above the header and doesn’t create change on the page. (I have removed for now)
The page I have the zooming issue on is my checkout pages: https://www.theshapingbay.com/checkout/
My shop setup using the bigcommerce for WordPress plugin, and the cart embeds an iframe onto the checkout pages.
Am I perhaps better off using CSS to increase the font size above 16px as per this article: https://stackoverflow.com/questions/2989263/disable-auto-zoom-in-input-text-tag-safari-on-iphone/6394497#6394497
Or using the function suggested in this thread (which doesn’t seem to work for me, not sure what I am missing)
Thanks for your help 🙂
August 9, 2022 at 10:09 pm #2308463Fernando Customer Support
Hi Justin,
How are you adding the filter hook?
August 9, 2022 at 10:12 pm #2308466Justin
Hey Fernando. In elements: Hook – wp-head
Adding this code suggested above:
add_filter( ‘generate_meta_viewport’, function() {
return ‘<meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0″ />’;
} );Display rules: Entire site
Thanks for your help
August 9, 2022 at 10:30 pm #2308473Fernando Customer Support
Can you try adding it through Code Snippets or functions.php if you’re using a Child theme?
August 9, 2022 at 10:56 pm #2308485Justin
Hey Fernando – I’m not using a child theme currently. Bigcommerce just embeds the iframes onto the relevant checkout pages.
How would I add the code through snippets? Would I need to change the code or just input it exactly as I had it in the head?
August 9, 2022 at 11:02 pm #2308491Fernando Customer Support
Code snippets reference: https://docs.generatepress.com/article/adding-php/#code-snippets
Enter the code as is.
August 9, 2022 at 11:04 pm #2308493Justin
Great thanks for your help Fernando :~)
August 9, 2022 at 11:14 pm #2308499Fernando Customer Support
You’re welcome Justin!
-
AuthorPosts
- You must be logged in to reply to this topic.