【发布时间】:2014-10-20 20:17:10
【问题描述】:
我正在学习 wordpress 主题开发。我想在我的主题选项页面中更改一些样式。这是css代码
background: #<?php echo esc_attr( get_option('header_bg') ); ?>;
主题选项页面
register_setting('theme-setting-group','header_bg');
CSS 文件位置:E:\xampp\htdocs\wordpress\wp-content\themes\theme-file\css\style.php 主题选项文件:E:\xampp\htdocs\wordpress\wp-content\themes\theme-file\functions.php
我还在我的 css php 文件中添加了这个
<?php header("Content-type: text/css", true);?>
当我将这些 css 样式放入 header.php 时,它工作正常。但是在 css php 文件中它显示了这个
致命错误:在 E:\xampp\htdocs\wordpress\wp-content\themes\theme-file\css\style.php 中调用未定义函数 esc_attr() b> 在第 28 行
【问题讨论】:
标签: php css wordpress wordpress-theming fatal-error