wordpress最新文章调用-♚纪实阁付涛♚

wordpress最新文章调用

今天在整理网站首页的时候,发现最新发布文章的调用不再需要了;但为了方便日后的使用,所以单独整理一篇文章作个记录:

具体代码如下

<div id="post_list_box" class="border_gray">
<?php
$scrollcount = get_option('ygj_new_post');
?>
<?php
query_posts('&showposts='.$scrollcount.'&ignore_sticky_posts=1.&cat='.get_option('ygj_new_exclude'));
while ( have_posts() ) : the_post();$do_not_duplicate[] = $post->ID; ?>
<article id="post-<?php the_ID(); ?>" class="archive-list">
<figure class="thumbnail">
<?php ygj_thumbnail(270,180); ?>
</figure>
<header class="entry-header">
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" target="_blank"><?php the_title(); ?></a>
</h2>
</header><!-- .entry-header -->
<div class="entry-content">
<span class="entry-meta">
<span class="post_cat">
<?php
$category = get_the_category();
if($category[0]){
echo '<a href='.get_category_link($category[0]->term_id ).'>'.$category[0]->cat_name.'</a>';
}
?>
</span>
<span class="post_spliter">•</span>
<span class="date" title="<?php the_time( 'Y/m/d H:i');?>"><?php
echo timeago(get_gmt_from_date(get_the_time('Y-m-d G:i:s'))) ?></span>
</span>
<div class="archive-content">
<?php if (has_excerpt()){ echo wp_trim_words( get_the_excerpt(), 80, '...' );} elseif
(post_password_required()){echo wp_trim_words( get_the_content(), 22, '...' ); }else { echo wp_trim_words(
get_the_content(), 80, '...' );} ?>
</div>
<div class="archive-tag"><span class="views"><?php if( function_exists( 'the_views' ) ) { print ' 阅读 ';
the_views(); print ' 次 '; } ;?></span><?php the_tags('', '', '');?></div>
<div class="clear"></div>
</div><!-- .entry-content -->
</article><!-- #post -->
<!-- ad -->
<?php if ($wp_query->current_post == 0) : ?>
<?php if (get_option('ygj_adh') == '显示') { get_template_part('/inc/ad/ad_h'); } ?>
<?php endif; ?>
<!-- end: ad -->
<?php endwhile; ?>
</div>
本文由 ♚纪实阁付涛♚ 作者:谍豹云销 发表,其版权均为 ♚纪实阁付涛♚ 所有,文章内容系作者个人观点,不代表 ♚纪实阁付涛♚ 对观点赞同或支持。如需转载,请注明文章来源。

发表评论