1
當我嘗試排隊定製css.php我得到錯誤500.下面是完整的代碼:wp_register_style和內部服務器錯誤
function custom_style() {
wp_register_style('custom-style', get_template_directory_uri() . '/css/custom-style.php', array(), '20152111');
wp_enqueue_style('custom-style');
}
add_action('wp_enqueue_scripts', 'custom_style');
這裏是定製style.php文件:
<?php header('Content-type: text/css'); ?>
<style>
body.single-post{
background:url(<?php echo esc_url($custombck); ?>) no-repeat center top !important;
background-size: contain !important;
background-position-y: -30% !important;
}
</style>
這就是基本樣式表的情況,但我需要在css中包含php代碼,這就是爲什麼我有自定義樣式.php – user1756097
好吧,我不明白你在做什麼。我現在明白了。我修改了我的答案。 –