Wordpress 优先 post 仅在首页不同于其他页面

Wordpress first post only on first page different then others

获取下一个代码以获取第一个 Wordpress post 只有第一页不同。但它不起作用。查看了其他问题和答案,但似乎没有很好的答案。

这是我得到的但对我不起作用:

<?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; ?>

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

提前致谢!

乔里

您似乎没有 endif 对应的内部 if。也许应该是:

   <?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; ?>