Wordpress:具有分頁的一頁中的多個自定義循環

[英]Wordpress: Multiple Custom Loop in One Page with Pagination


I find the explanation here very useful : http://codex.wordpress.org/The_Loop#Multiple_Loops , except it doesn't tell me how to get pagination for multiple loops. I read some similar questions here too, but they are either not answered or doesn't really work. Below are the codes I use for two different custom loops:

我發現這里的解釋非常有用:http://codex.wordpress.org/The_Loop#Multiple_Loops,除了它沒有告訴我如何為多個循環分頁。我也在這里閱讀了一些類似的問題,但它們要么沒有回答,要么沒有真正起作用。以下是我用於兩個不同自定義循環的代碼:

$myLoop1 = new WP_Query("tag='myTag1'&showposts=5"&paged=" . $paged ); 
while($myLoop1->have_posts()) : $myLoop1->the_post();
//do something...
endwhile;



$myLoop2 = new WP_Query("tag='myTag2'&showposts=5"&paged=" . $paged ); 
while($myLoop2->have_posts()) : $myLoop2->the_post();
//do something...
endwhile;

The tutorial here: http://www.kriesi.at/archives/how-to-build-a-wordpress-post-pagination-without-plugin/ should be able to get the pagination done smoothly, but I tried many many times, it never work. The link of page is always www.myDomain.com/page/# which is a general page address instead of my custom loop.

這里的教程:http://www.kriesi.at/archives/how-to-build-a-wordpress-post-pagination-without-plugin/應該能夠順利完成分頁,但我嘗試了很多次,它永遠不會奏效。頁面鏈接始終是www.myDomain.com/page/#這是一般頁面地址而不是我的自定義循環。

Moreover, is it possible to ajaxify the pagination so visitors can go to different pages of the loops while staying on the page? This is minor, the first question is much more important to me. Thanks in advance!

此外,是否可以對分頁進行分類,以便訪問者在停留在頁面上時可以訪問不同的循環頁面?這是次要的,第一個問題對我來說更重要。提前致謝!

1 个解决方案

#1


0  

Finally I found the solution thanks to @brasofilo 's advice! The answer from the following link allow you to have as many custom loops as you want all in the same page!

最后,由於@brasofilo的建議,我找到了解決方案!以下鏈接的答案允許您在同一頁面中擁有所需數量的自定義循環!

https://wordpress.stackexchange.com/questions/47259/multiple-wp-query-loops-with-pagination

p.s. If anyone has ajax solution, I would love to know!

附:如果有人有ajax解決方案,我很想知道!


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2013/01/24/d60e5817b289254235a3e913e7b35a20.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com