TStyle主题类目页(category)显示文章摘要输出

林继 WordPress 2,605 共写了136个字 (2010-12-24 1:00:11) 没有评论 打印 扫描二维码 百度已收录

1.插入以下内容到style.css:

  1. .post{border-bottom: 1px dashed #8080FF;margin-top: 10px;text-align: left;} 
  2. .post h2{clear: both; padding: 0;margin:0; line-height: 31px;height: 31px;} 
  3. .post h2 em{font-size:16px;float: left;max-width: 560px; overflow: hidden; white-space: nowrap;} 
  4. .post a{color: #004499;text-decoration: none;} 
  5. .post a:hover{color: #CC0000;text-decoration: underline;} 
  6. .post p{line-height: 20px; margin-bottom: 10px;list-style: none outside none;} 
  7. .post h2 i.new,.post h2 i.hot,.post h2 i.top { margin: 10px 0px 0px 3px;} 
  8. .post h2 span { float: right; width: 33px; font-size: 12px; color: #666; text-align: right; white-space: nowrap; overflow: hidden; } 
  9. .post h2 a{font-weight:bold;}

2.修改achieve.php:

  1. <li id="post-<?php the_ID(); ?>"> 
  2.     <em><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></em> 
  3.     <?php if(date("ymd") - get_the_time("ymd") <= 3) echo '<i class="new">最新</i>'; ?> 
  4.     <?php if(get_comments_number() > 10) echo '<i class="hot">热门</i>'; ?> 
  5.     <?php if(is_sticky()) echo '<i class="top">推荐</i>'; ?> 
  6.     <span class="date"><?php the_time('m-d'); ?></span> 
  7. </li>

替换为:

  1. <div class="post"> 
  2.     <h2> 
  3.     <em><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('%s', 'kubrick'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></em> 
  4.     <?php if(date("ymd") - get_the_time("ymd") <= 3) echo '<i class="new">最新</i>'; ?> 
  5.     <?php if(get_comments_number() > 10) echo '<i class="hot">热门</i>'; ?> 
  6.     <?php if(is_sticky()) echo '<i class="top">推荐</i>'; ?><span class="date"><?php the_time('m-d'); ?></span></h2> 
  7.     <p><?php echo mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 250,"...");?> 
  8.     </p> 
  9.     <p><a title="阅读全文" class="morelink" href="<?php the_permalink() ?>">阅读全文</a></p> 
  10.     <p><?php the_tags( '标签:' , ', ' , '.'); ?></p> 
  11. </div>

OK!搞定!

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注

< >