最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How can I pass a variable from a template to header.php of a theme

programmeradmin1浏览0评论

As of version 5.5.0, WordPress introduced second argument (array $args) to get_header.

I am calling get_header in my templates including index.php and I want to pass meta description value from template to header.php

And I am trying this

$args = array('Index meta desc');
get_header(null, $args);

While in header.php file the value of $args is an empty array.

Not sure, if I am calling the variable correctly.

Any comment/answer will be helpful.
Thank you.

发布评论

评论列表(0)

  1. 暂无评论