Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress仅在第一页上发布第一篇文章与其他文章不同_Php_Wordpress_Loops_Post - Fatal编程技术网

Php Wordpress仅在第一页上发布第一篇文章与其他文章不同

Php Wordpress仅在第一页上发布第一篇文章与其他文章不同,php,wordpress,loops,post,Php,Wordpress,Loops,Post,获取下一个代码以获取第一个Wordpress帖子,但第一个页面上的内容有所不同。但它不起作用。看了其他的问题和答案,但似乎没有一个好的答案 这是我所拥有的,但并不适用于我: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array('posts_per_page' => 5, 'paged' => $paged ); query_posts($args); ?>

获取下一个代码以获取第一个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; ?>

我得到了这个语法错误“unexpected T_ENDWHILE”,但不知道为什么。 有人知道如何正确地完成这项工作吗

提前谢谢


Joeri

看起来你没有一个内部的
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; ?>


Ow my。。完全错过了。。谢谢你的快速回答!现在我已经想出了所有的代码和东西;)关于如何在第一页显示不同于其他页面的帖子数量的任何想法。这是因为它是一个2列的界面,现在第一页上较小的帖子是不均匀的。。会让我开心的!Cheers@user3241326,如果答案是正确的,投票并接受它会让人们知道!