简体   繁体   English

在wordpress主题的header中调用自定义php function

[英]Call a custom php function in header of wordpress theme

I have defined a custom function in functions.php., And I want to call it in header, exactly as <meta name="description" content="<?php meta_desc(); ?>"> .我在 functions.php. 中定义了一个自定义的 function,我想在 header 中调用它,与<meta name="description" content="<?php meta_desc(); ?>">完全一样。 But I am seeing empty meta description when I view source code.但是当我查看源代码时,我看到的是空的元描述。 This custom function works well If I use it somewhere else.这个自定义 function 如果我在其他地方使用它,效果很好。

Hope this helps you:希望这可以帮助你:

<meta name="description" content="<?php echo meta_desc(); ?>">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM