这是算是比较老的教程了。只有两个注意的地方,我从自己主题的主循环中抽前面的重点部分写下来,前段时候制作INLOXZ主题时要用到的主循环排除功能,网上比较难找到找到适用主循环的,所以顺便做个记录:

<div class="post-warp">
 <?php $the_query = new WP_Query( array( 'post__not_in' => get_option( 'sticky_posts' ) , 'offset' => 1) ); // 排除置顶和首篇文章
 if ( $the_query->have_posts() ) { ?>
 <?php while ( $the_query->have_posts() ) { $the_query->the_post(); global $post; ?>
 <?php $post_format = inlo_get_post_format(); ?>
 <div class="post-box">
 <?php if ( post_password_required( $post->ID ) ) { ?>
 <div class="password-post-content">
 <?php echo get_the_password_form( $post->ID ); ?>
 </div>
 <?php } else { ?>
 <div class="post-header">
 <h3 class="post-title tra"><a href="<?php the_permalink(); ?>" class="tra"><?php the_title(); ?></a></h3>
 <a class="comments-link"><?php echo inlo_comts_count( $post->ID ); ?></a>
 </div>
 ...

看2、3、4行 和注释就明白了。
wordpress