wordpress 为不同分类指定不同的模板/样式表/图片
为每个分类指定不同的模板
<?php
if(in_category('3')){
include(TEMPLATEPATH .'/cat3.php');
}else if(in_category('4')){
include(TEMPLATEPATH .'/cat4.php');
}else {
include(TEMPLATEPATH.'/cat.php');
}
?>
为不同分类指定不同的样式表
<?php if(is_category('5')){?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/cat-5.CSS" type="text/css" media="screen" />;
<?php }else{ ?>
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" media="all" />
<?php } ?>
为不同的分类指定不同的图像
<?php if(is_category('4') ){?>
<img src='<?php bloginfo('template_url');?>/images/new.gif' alt='' />
<?php }elseif(is_category('3') ){?>
<img src='<?php bloginfo('template_url');?>/images/about.gif' alt='' />
<? } ?>
|