Archived topic
Meta VIEWPORT, in CHILD THEME
6 replies · Started by ortegamun on May 11, 2021
If the viewport meta should be located in the generatepress header, ¿where should the viewport meta be inserted into the child theme, if it does not have a header.php?
Hi there,
the viewport meta is output with this filter:
https://docs.generatepress.com/article/generate_meta_viewport/
So you can use a function like the one in this topic to change its value:
https://generatepress.com/forums/topic/disable-mobile-view/#post-1746812
Thank you, David, for the speed. But I don't think I explained myself well because I'm using the translator. I explain: I'm using a child generatepress theme and I need to know where to insert the viewport meta (for viewport to suit all devices). Because I know that viewport should be inserted into the generatepress header, however my child theme contains only three files: functions.php screenshot.php and styles.css
The parent theme already includes the viewport meta.
If you want to change it in your child theme then you would add a snippet like the one provided here in your Child Themes functions.php - this will change the viewport meta that is set in the parent theme ... no need to edit templates :)
Thank you for your response. I went into the header.php I can't find the standard viewport meta. So I had to introduce her. Did I do the right thing?
In fact, Google warned me that the content didn't fit mobile devices.
In fact, Google warned me that the content didn't fit mobile devices.
Theres no need to include it in the header.php
GP Hooks the function into the wp_head - see here:
You simply need to add the filter snippet i provided to change its output.
However, this: Google warned me that the content didn’t fit mobile devices. shouldn't be an issue with the Theme. It sounds like some other element was overflowing the content.