Php Wordpress仅在第一页上发布第一篇文章与其他文章不同
获取下一个代码以获取第一个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); ?>
<?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,如果答案是正确的,投票并接受它会让人们知道!