Title: Pagination with multiple loops in single.php using custom permalink structure
Last modified: August 19, 2016

---

# Pagination with multiple loops in single.php using custom permalink structure

 *  [mankot](https://wordpress.org/support/users/mankot/)
 * (@mankot)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/pagination-with-multiple-loops-in-singlephp-using-custom-permalink-structure/)
 * 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&amp;meta_value='.$id.'&amp;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!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Justin Tadlock](https://wordpress.org/support/users/greenshady/)
 * (@greenshady)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/pagination-with-multiple-loops-in-singlephp-using-custom-permalink-structure/#post-1047223)
 * 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).
 *  Thread Starter [mankot](https://wordpress.org/support/users/mankot/)
 * (@mankot)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/pagination-with-multiple-loops-in-singlephp-using-custom-permalink-structure/#post-1047241)
 * 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
 *  [behem0t](https://wordpress.org/support/users/behem0t/)
 * (@behem0t)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/pagination-with-multiple-loops-in-singlephp-using-custom-permalink-structure/#post-1047468)
 * Mankot,
 * i’m having exactly the same problem. Have you found a way of making this work?
 * Thanks in advance,
 * best regards,
 * behem0t
 *  [azenalex](https://wordpress.org/support/users/azenalex/)
 * (@azenalex)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/pagination-with-multiple-loops-in-singlephp-using-custom-permalink-structure/#post-1047488)
 * I’m also having this problem now… perhaps someone can come up with a solution?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Pagination with multiple loops in single.php using custom permalink structure’
is closed to new replies.

## Tags

 * [multiple loops](https://wordpress.org/support/topic-tag/multiple-loops/)
 * [pagination](https://wordpress.org/support/topic-tag/pagination/)
 * [permalinks](https://wordpress.org/support/topic-tag/permalinks/)
 * [single.php](https://wordpress.org/support/topic-tag/single-php/)

 * 4 replies
 * 4 participants
 * Last reply from: [azenalex](https://wordpress.org/support/users/azenalex/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/pagination-with-multiple-loops-in-singlephp-using-custom-permalink-structure/#post-1047488)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
