php - Particular meta tag - viewport - insertion when dealing with plugin

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=

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.

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.

Share Improve this question asked Aug 8, 2019 at 7:53 WordCentWordCent 1,8916 gold badges34 silver badges60 bronze badges 7
  • 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 Commented Aug 8, 2019 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. – WordCent Commented Aug 8, 2019 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 Commented Aug 8, 2019 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. – WordCent Commented Aug 8, 2019 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 Commented Aug 8, 2019 at 8:15
 |  Show 2 more comments

1 Answer 1

Reset to default 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745259931a4619164.html

相关推荐

  • php - Particular meta tag - viewport - insertion when dealing with plugin

    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=

    4小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信