我正在为wordpress构建一个动态页面模板(这意味着它必须至少工作4个不同的域而不更改链接等任何内容)并且我添加了这样的自定义css链接:
<link type="text/css" rel="stylesheet" href="https://mywebsite.com/wp-content/themes/mytheme/css/page-food.css">
我可以使用$home_path
这样的变量到达服务器主页。或者像$theme_path
这样的主题主文件夹。那么有没有可能的方法来添加一个PHP变量?
我的意思是
<link type="text/css" rel="stylesheet" href="$theme_path/css/page-food.css">
答案 0 :(得分:4)
只需在那里添加php开始和结束标签
<link type="text/css" rel="stylesheet" href="<?=$theme_path?>/css/page-food.css">
答案 1 :(得分:1)
wordpress css call in daynamic path
<link href="<?php echo get_template_directory_uri(); ?>/css/fonts.css" type="text/css" rel="stylesheet">