2013-05-08 65 views
0

希望有人能幫助我,我一直對這個試圖找到答案掙扎了好幾天......WordPress的 - 通過滑塊

基本上調用上的帖子不同類別的,我有,有一個WordPress站點一個使用'get_template'調用的滑塊(不是插件只是開源代碼),但它在每個頁面上顯示相同的三個帖子。我在不同的類別中有不同的帖子,並希望滑塊在每個單獨的頁面上對應,並且回顯每個特定類別的帖子。


<div id="slidorion"> 
<div id="slider"> 

<?php 
query_posts('posts_per_page=3'); 
if (have_posts()) : while (have_posts()) : the_post(); ?> 

<div class="slide">"><?php the_post_thumbnail(); ?></div> 

<?php endwhile; ?> 
<?php endif; ?> 

</div> 

<div id="accordion"> 

<?php if (have_posts()) : while (have_posts()) : the_post(); ?> 

<div class="link-header"><?php the_title(); ?></div> 
<div class="link-content"> 

<?php the_excerpt(); ?> 

</div> 

<?php endwhile; ?> 
<?php endif; ?> 

</div> 
</div> 

這裏是該網站的鏈接,如果你需要看它完全明白我的意思,需要做...

http://www.kaijocreative.co.uk/footballnatter

謝謝!

回答

0

你需要使用找出從每個類別ID添加catcategoryquery_posts('posts_per_page=3');然後使用這些ID在

$ category = get_the_category();

$ post_catid = $ category [0] - > term_id;

$ querystr ='cat ='。$ post_catid。' & posts_per_page = 3';

query_posts($ querystr);