wordpress 为不同分类指定不同的模板
为每个分类指定不同的模板
|
1
2
3
4
5
6
7
8
9 |
<?php if(in_category('3')){ include(TEMPLATEPATH .'/cat3.php'); }else if(in_category('4')){ include(TEMPLATEPATH .'/cat4.php'); }else { include(TEMPLATEPATH.'/cat.php'); } ?> |
为不同分类指定不同的样式表
|
1
2
3
4
5 |
<?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 } ?> |
为不同的分类指定不同的图像
|
1
2
3
4
5 |
<?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='' /> <? } ?> |
如果出现代码错误,请注意中英文符号。
链接: wordpress 为不同分类指定不同的模板/样式表/图片
下一篇: Nextgen Gallery的代码引用

ahaoxie