【发布时间】:2021-02-06 04:10:18
【问题描述】:
我在网上搜索过,但我看到的结果不够清楚。
通过将此代码添加到 functions.php 文件中,我能够将 manifest.json 文件添加到我的 wordpress 主题中。
//manifest file
add_action( 'wp_head', 'inc_manifest_link' );
// Creates the link tag
function inc_manifest_link() {
echo '<link rel="manifest" href="'.get_template_directory_uri().'/manifest.json">';
}
manifest.json 应该是这样的。
但是我希望在清单文件中使用一些 theme_mod 函数。没有 php 是我做不到的。
那么有没有办法在 manifest.json 文件中编写 php 代码。
提前致谢。
【问题讨论】:
-
怎么样把它放到 manifest.json 中作为 php 执行?或者在 manifest.json 中添加另一个变量
-
将 wp 变量添加到 manifest.json
-
查看答案,看看是否能帮助你萌芽@ZeddyEmy
标签: php wordpress wordpress-theming progressive-web-apps manifest.json