上一篇分析的是情侣模板的基本布局,接下来就是评论部分。主要是判断非作者、作者A和作者B,还有奇偶的问题。
1. 修改comments.php,在wp_list_comments代码那加上&callback=my_comment。
- < ?php wp_list_comments('type=comment&callback=my_comment'); ?>
阅读全文 »
2009-03-09
WordPress
5,110 人浏览
CSS, theme, 情侣, 模板
这个网站的布局很特别,首页是三栏,左右不同的颜色,文章页根据不同的作者显示不同的颜色,页面又是一种风格。
1. 首先区分页面,首页,作者A和作者B。
- < ?php if (is_page()) {
- $style_item = 'page';
- } elseif (is_single()) {
- if ($post->post_author == '1') {
- $style_item = 'left';
- }
- elseif ($post->post_author == '2') {
- $style_item = 'right';
- }
- } else {
- $style_item = 'normal';
- } ?>
把定义的$style_item加在DIV框架内,以方便用CSS控制显示。
- <div id="page" class="wrap-<?php echo($style_item); ?>"></div>
阅读全文 »
2009-03-07
WordPress
2,181 人浏览
CSS, theme, 情侣, 模板