WordPress仅在第一页上发布与其他帖子不同


Wordpress first post only on first page different then others

得到了下一个代码,让只有第一页上的第一个Wordpress帖子是不同的。但它不起作用。查看了其他问题和答案,但似乎没有一个好的答案。

这是我所拥有的,但对我不起作用:

<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('posts_per_page' => 5, 'paged' => $paged );
query_posts($args); ?>
<?php if (have_posts()) : ?>
<?php $postcount = 0; ?>
<?php while (have_posts()) : the_post(); ?>
<?php $postcount++; ?>
    <?php if ($postcount == 1 && $paged == 1) : // if this is the first post & first page ?>
    <div class="large-10">
    <?php the_post_thumbnail('large'); ?>
    </div>
        <?php else : //if this is NOT the first post ?>         
        <div class="large-6 columns">
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <div class="portfolio">
            <a href="<?php the_permalink(); ?>">
            <?php the_post_thumbnail('large'); ?>
            <span><h6><?php the_title(); ?></h6></span>
            </a>
        </div>
        </article>
        </div>
    <?php endwhile; ?>
<?php endif; ?>

我收到此语法错误"意外T_ENDWHILE",但无法弄清楚原因。有谁知道如何正确地完成这项工作?

提前感谢!

乔里

看起来你对那个内在if没有endif.也许应该是:

   <?php if ($postcount == 1 && $paged == 1) : // if this is the first post & first page ?>
    <div class="large-10">
    <?php the_post_thumbnail('large'); ?>
    </div>
    <?php else : //if this is NOT the first post ?>         
        <div class="large-6 columns">
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <div class="portfolio">
            <a href="<?php the_permalink(); ?>">
            <?php the_post_thumbnail('large'); ?>
            <span><h6><?php the_title(); ?></h6></span>
            </a>
        </div>
        </article>
        </div>
   <?php endif; ?>