WordPress.org

Ready to get started?Download WordPress

Forums

How to paginate a secondary loop ? (3 posts)

  1. yagraph
    Member
    Posted 3 years ago #

    Hi all,

    I'm doing a podcast website for an university, here : http://podcast.grenet.fr/
    containing some podcast post showing episodes :
    http://podcast.grenet.fr/structures/ujf/midisciences/
    syndicated through FeedWordPress on a PHP 5 server.

    To display episodes, I use a secondary loop in single.php when a post is in the podcast category, requesting for posts with the corresponding meta value (podcast_syndication_source)...
    Everything goes well, but... I cannot achieve to paginate this episodes inside the podcast post...

    here is my single.php :

    [Large code excerpt removed by moderator. Per forum rules, please use the pastebin for all large code excerpts. It works better anyway.]

    The problem is that if I try to go on the 'Older Entries' button, I go back to the first page (reseted I suppose), so I never see the second one...
    So I suppose that I have to store it in a variable like $episodes... but I can't figure how to achieve it precisely...

    Another problem is that posts_nav_link() or any of its variant seem to do not work inside $episodes = new WP_Query.

    I used to use query_posts instead of $episodes = new WP_Query, but despite the fact that posts_nav_link() was working, it's the same.

    Please bring me the light !
    Thanks in advance,
    yagraph

  2. yagraph
    Member
    Posted 3 years ago #

    Sorry, that's right that's a lot of code...
    So, I finally put the entire single.php file in the pastebin :
    http://wordpress.pastebin.com/nxTD1rh0
    It's widely commented, so I hope it will be clear enough.

  3. yagraph
    Member
    Posted 3 years ago #

    ok, after hours of googling, I solved posts_nav_link() disappearing problem, and use WP_Query for each loop, witch is supposed to be cleaner :
    http://wordpress.pastebin.com/jDWejQEn

    But I'm still stuck ... the "Previous Posts" button send to "[same url]/page/2", and that's not what I want : I'd like to see the previous 10 posts with the same meta_value ...

    Maybe this post should be put in the Advanced section ?

Topic Closed

This topic has been closed to new replies.

About this Topic