PHP 每个帖子的自定义CSS
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 每个帖子的自定义CSS相关的知识,希望对你有一定的参考价值。
function artStyle() {
global $post;
if (is_single()) {
$currentID = $post->ID;
$serverfilepath = TEMPLATEPATH.'/art-direction/style-'.$currentID.'.css';
$publicfilepath = get_bloginfo('template_url');
$publicfilepath .= '/art-direction/style-'.$currentID.'.css';
if (file_exists($serverfilepath)) {
echo "<link rel='stylesheet' type=text/css' href='$publicfilepath' media='screen' />"."\n";
}
}
}
add_action('wp_head', 'artStyle');
以上是关于PHP 每个帖子的自定义CSS的主要内容,如果未能解决你的问题,请参考以下文章