-1

I am dealing with a plugin, not with a theme, but what I want is to include this meta in the head section.

<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">

I browsed this link, but this link is also not helpful.

I believe it is doable through hooks and filter somehow.

w/o this meta tag the content is shrinking, including fonts getting minimized.

  • This has no business being part of a plugin. It affects the appearance of the site so is the theme's responsibility. If something like this isn't already in the theme, then it's likely not a responsive theme, and adding this won't fix that. – Jacob Peattie Aug 8 at 8:05
  • If it is not implemented by a theme. It becomes the business of a plugin creator to implement it. Have some empathy before nurturing a tendency to downvote all the time. I hardly remember any post in the past that you have not downvoted. despite the fact that this may be helpful for many in the future. – The WP Intermediate Aug 8 at 8:06
  • It is not the business of a plugin creator to implement anything like this. That's not how that works. This code does nothing useful unless the theme is built to support it, in which case it would already have it. – Jacob Peattie Aug 8 at 8:09
  • I know but you can check here even default 2019 is not supporting → not supporting That's why I said please have some empathy to OP. – The WP Intermediate Aug 8 at 8:10
  • 1
    Twenty Nineteen already has that meta tag. It's a responsive theme. The reason stuff is appearing zoomed out is because of your CSS. If you look at the page you'll see that stuff is zoomed out because you have a popover element positioned absolutely over to the right. If you delete the popover element you'll see the issue is fixed. – Jacob Peattie Aug 8 at 8:15
0

Cant you just use the wp_head action for this? I mean something like this:

function add_meta_tags() {
?>
  <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<?php }
add_action('wp_head', 'add_meta_tags');

Should work perfectly.

  • I tried a similar thing, but didnt worked. Let me try your code and check my own. Have you ever tested this one. – The WP Intermediate Aug 8 at 7:58
  • Alright - I assume you're writing your own plugin - otherwise I would suggest to add this to the theme functions.php, instead of editing an existing plugin. And yes, I've used wp_head several times to add meta to the head-section. Ex. facebook OG meta etc. – WPTricksDK Aug 8 at 7:59
  • I am using the default 2019 theme. I am facing the problem here – The WP Intermediate Aug 8 at 8:07
  • 1
    I see the viewport is set already. Although, I would not suggest using "minimum-scale" as your might be restricting people who may have a visual impairment. – WPTricksDK Aug 8 at 8:16
  • Currently I am troubleshooting the issue at hand. – The WP Intermediate Aug 8 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.