1
得到下一個代碼,以獲得第一個頁面上的第一個WordPress的帖子是不同的。但它不起作用。看着其他問題和答案,但似乎沒有一個好的答案。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」,但不能找出原因。 有誰知道如何正確完成這件事?
在此先感謝!
Joeri
我的..完全錯過了..謝謝你的快速回答! – Codigit 2015-01-31 20:07:07
現在我已經提出了整個代碼和東西;)關於如何在第一頁顯示不同數量的帖子而不是在其他頁面上的任何想法。這是因爲它是一個2列的界面,現在第一頁上的較小的帖子是不均勻的..會讓我的一天!乾杯 – Codigit 2015-01-31 20:24:53
@ user3241326,如果答案是正確的,upvoting它並接受它會讓人們知道! – ASGM 2015-01-31 21:57:11