archive_title.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php if( dopt('d_adindex_02_b') ) printf('<div class="banner banner-sticky">'.dopt('d_adindex_02').'</div>'); ?>
  2. <?php
  3. $_author = dopt('d_post_author_b');
  4. $_time = dopt('d_post_time_b');
  5. $_views = dopt('d_post_views_b');
  6. $_comment = dopt('d_post_comment_b');
  7. ?>
  8. <?php while ( have_posts() ) : the_post(); ?>
  9. <?php
  10. $_thumbnail = false;
  11. if( has_post_thumbnail() || !dopt('d_thumbnail_b') ){
  12. $_thumbnail = true;
  13. }
  14. ?><?php
  15. $s = trim(get_search_query()) ? trim(get_search_query()) : 0;
  16. $title = get_the_title();
  17. $content = mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 260,"......",'utf-8');//300是摘要字符数,......是结束符号。
  18. if($s){$keys = explode(" ",$s);
  19. $title = preg_replace('/('.implode('|', $keys) .')/iu','<span style="color:#b94a48;">\0</span>',$title);
  20. $content = preg_replace('/('.implode('|', $keys) .')/iu','<span style="color:#b94a48;">\0</span>',$content);
  21. }?>
  22. <article class="excerpt<?php echo !$_thumbnail ? ' excerpt-nothumbnail' : '' ?>">
  23. <header>
  24. <?php
  25. if( !is_category() ) {
  26. $category = get_the_category();
  27. if($category[0]){
  28. echo '<a class="label label-important" href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'<i class="label-arrow"></i></a>';
  29. }
  30. };
  31. ?>
  32. <h2><a target="_blank" href="<?php the_permalink() ?>" title="<?php the_title(); ?> - <?php bloginfo('name'); ?>"><?php echo $title; ?></a></h2>
  33. </header>
  34. <?php if( $_thumbnail ){ ?>
  35. <div class="focus"><a target="_blank" href="<?php the_permalink(); ?>"><img class="thumb" src="<?php echo get_bloginfo("template_url") ?>/timthumb.php?src=<?php echo post_thumbnail_src(); ?>&h=123&w=200&q=90&zc=1&ct=1" alt="<?php the_title(); ?>" /></a></div>
  36. <?php } ?>
  37. <span class="note"> <?php echo $content;?></span>
  38. <p class="auth-span">
  39. <?php if( !is_author() && !$_author ){ ?>
  40. <span class="muted"><i class="fa fa-user"></i> <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ) ?>"><?php echo get_the_author() ?></a></span>
  41. <?php } ?>
  42. <?php if( !$_time ){ ?><span class="muted"><i class="fa fa-clock-o"></i> <?php echo timeago( get_gmt_from_date(get_the_time('Y-m-d G:i:s')) ) ?></span><?php } ?>
  43. <?php if( !$_views ){ ?><span class="muted"><i class="fa fa-eye"></i> <?php deel_views('℃'); ?></span><?php } ?>
  44. <?php if( !$_comment ){ ?><span class="muted"><i class="fa fa-comments-o"></i> <?php
  45. if ( comments_open() ) echo '<a target="_blank" href="'.get_comments_link().'">'.get_comments_number('0', '1', '%').'评论</a>'
  46. ?></span><?php } ?>
  47. <?php if( !$_like ){ ?><span class="muted">
  48. <a href="javascript:;" data-action="ding" data-id="<?php the_ID(); ?>" id="Addlike" class="action<?php if(isset($_COOKIE['bigfa_ding_'.$post->ID])) echo ' actived';?>"><i class="fa fa-heart-o"></i><span class="count"><?php if( get_post_meta($post->ID,'bigfa_ding',true) ){ echo get_post_meta($post->ID,'bigfa_ding',true); } else {echo '0';}?></span>喜欢</a></span><?php } ?></p>
  49. </article>
  50. <?php endwhile; wp_reset_query(); ?>
  51. <?php deel_paging(); ?>