0
這是一個我一直在努力的複雜的一個。我有四個主要類別。正式,時髦,社交和婚禮。我設置了Wordpress,以便在一節中顯示所有這些內容的12個最新帖子。Wordpress如果帖子標題已在頁面上從列表中刪除
<li>
<?php $recent = new WP_Query("category_name=social,fashion,wedding,formal&showposts=1&offset=1"); while($recent->have_posts()) : $recent->the_post();?>
<div class="show">
<a class="thumb" href="<?php the_permalink() ?>">
<?php the_post_thumbnail(); ?>
</a>
<a href="<?php the_permalink() ?>">
<section class="phototitle"><p><?php the_title(); ?></p></section>
</a>
</div>
<?php endwhile; ?>
</li>
這工作正常,我使用偏移功能來反覆顯示它們。
然後我在下面列出的分類框中列出了相同的四類。所以他們有點秩序。
<section class="postlist">
<h1>Formal</h1>
<hr>
<?php $recent = new WP_Query("category_name=formal&showposts=6"); while($recent->have_posts()) : $recent->the_post();?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a><br />
<?php endwhile; ?>
</section>
我的問題是如何停止從頂部部分重複的職位,因此postlist部分將有不同的鏈接標題。
我認爲這可能與排除技術有關,如果標題已經出現在頁面上,請將其刪除。或者如果標題在頁面上,並且頂部的孩子刪除或者沿着這些行刪除。
問題是頂端部是隨機的,所以我可以僅通過12.
理解的任何輸入失調它。
乾杯
這是什麼樣的風格Hakre? – disco
類似於WP_Query(「category_name = formal&showposts = 6& - (topsectionid)」) – disco