ですから、WPテーマのフォルダーにあるindex.phpを編集しています。基本的に、これを実行したいのは次のとおりです。
ブログの最初のページに4つの投稿を表示します。
最初のページの最初の(最新の)投稿のスタイルを変えます。他の3つも同じようにスタイリングします。
他のすべてのページ付けされたページに6つの投稿を表示します。
これが私が作業しているループです。最初のページは正常に表示されますが、何らかの理由で2ページ目以降では実行が非常に奇妙で、追加の各ページに1つの投稿しか表示されません。また、タイトルのみが表示され、日付や抜粋は表示されません。これが私のコードです:
<?php
if( is_home() && !is_paged() ){
global $query_string;
parse_str( $query_string, $args );
$args['posts_per_page'] = 4;
query_posts($args);
if (have_posts()) :
while (have_posts()) : the_post();
if (++$counter == 1) { ?>
<div class="featured_post">
<p class="date"><?php the_date('M j, Y'); ?></p>
<a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('featuredblog'); ?></a>
<?php the_excerpt(); ?>
</div>
<?php } else { ?>
<div class="regular_post">
<p class="date"><?php the_date('M j, Y'); ?></p>
<div class="postimage"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('regularblog'); ?></a></div>
<a href="<?php the_permalink(); ?>"><h3><?php
// short_title($after, $length)
echo short_title('...', 7);
?></h3></a>
<?php the_excerpt(); ?>
</div>
<?php } ?>
<?php endwhile;
else :
// Code for no posts found here
endif;
} else {
global $query_string;
parse_str( $query_string, $args );
$args['posts_per_page'] = 6;
query_posts($args); ?>
<div class="regular_post">
<p class="date"><?php the_date('M j, Y'); ?></p>
<div class="postimage"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('regularblog'); ?></a></div>
<a href="<?php the_permalink(); ?>"><h3><?php the_title(); ?></h3></a>
<?php the_excerpt(); ?>
</div>
<?php } ?>
たぶん、そこに...他のステートメントが多すぎますか?