WordPress.org

Ready to get started?Download WordPress

Forums

Pagination with multiple loops in single.php using custom permalink structure (5 posts)

  1. Mankot
    Member
    Posted 5 years ago #

    Hey everybody,

    I've tried nearly every recommended solution that I found in this forum but none of those fixed my problem. I got 2 loops in a single.php...
    the first loop is a custom loop that displays all articles with certain meta key value. The second loop is the loop for the requested single article.

    Now I want pagination to work for the first loop. This is what the important part looks like:

    $paged = (get_query_var('paged'));
    $wp_query->query('meta_key=example&meta_value='.$id.'&paged='.$paged);

    Everything works fine except pagination and only if I'm using a custom permalink structure. With default permalink structure turned on even pagination worsk (id=X&paged=X).

    Tryin to access domain.tld/archives/676/page/2 redirects me to domain.tld/archives/676/

    But as I said using default permalink structure "domain.tld/?p=676&paged=2" just works like a charm displaying the right posts.

    Any ideas?

    This one drives me crazy! Thanks in advance!

  2. Justin Tadlock
    Member
    Posted 5 years ago #

    I'm not even sure how feasible this is. single.php is meant to display a single post. Now, that post itself could be paginated using <!--nextpage-->, but that's a little off-topic.

    My question is: Where is it supposed to paginate to? Anything branching off a single-post permalink should be a child of that particular single post (i.e. attachments).

  3. Mankot
    Member
    Posted 5 years ago #

    Thanks for ur reply.

    I know that single.php is meant to display a single post but I also know what wordpress is capable of. I wasn't really sure if this will work and I just gave it a try. Surprisingly pagination WORKS with default permalink structure on single.php with a custom query (e.g. domain.tld?id=1&paged=2) But it does not work with custom permalink structure. We only have to figure out why.

    The requested post is beeing displayed by single.php. After this single post I'm goin to display all posts of a certain category which I want to be paginated.

    E.g.:

    Header

    Single Post
    Post of certain category
    Post of certain category
    Post of certain category
    Pagination

    Footer

    If there is no reasonable chance to achieve this by using the pagination funcionality of wordpress I'll try a custom pagination using ajax.

    Hope I made it clear

    Thanks so far

  4. behem0t
    Member
    Posted 4 years ago #

    Mankot,

    i'm having exactly the same problem. Have you found a way of making this work?

    Thanks in advance,

    best regards,

    behem0t

  5. azenalex
    Member
    Posted 4 years ago #

    I'm also having this problem now... perhaps someone can come up with a solution?

Topic Closed

This topic has been closed to new replies.

About this Topic