[wp-hackers] Posts 2 Posts: Pagination for connected posts on single post template

Md Mahmudur Rahman iammahmudur at gmail.com
Thu Jun 27 09:07:30 UTC 2013

Hello Hackers,

I'm using Posts 2
to create connection for artists and posts. This way the site can display
the artist details and connected posts (news/photo galleries/videos) about
the artist on a single page.

I modified the single-artist.php to show the artist details (primary loop)
and connected posts (secondary loop) below it. I can get the connected post
and paginate them by the following code but the pagination links are not

// Find connected posts
$connected = new WP_Query( array(
    'connected_type' => 'artists_to_posts',
    'connected_items' => get_queried_object(),
    'paged' => (get_query_var('page')) ? get_query_var('page') : 1,
) );

As a result, when I am going to
http://localhost/artist/artist-name/page/2 redirects
me back to http://localhost/artist/artist-name/ so I can't go to the
paginated links and can only see the most recent connected posts.

Here is:


I know the single post template is only meant to show the current post, so
I'm not sure what should I do in this case. Hope someone can give me a

*Many thanks*
*Mahmudur Rahman*

More information about the wp-hackers mailing list