[wp-hackers] Posts 2 Posts: Pagination for connected posts on single post template
Md Mahmudur Rahman
iammahmudur at gmail.com
Thu Jun 27 23:37:34 UTC 2013
Hi
I have tried that as well. But no luck.
The pagination links are part of a secondary loop on a single page
template. And I can see that get_query_var('paged') always returning 1. As
a result the pagination links are not working.
Is it possible to paginate through a secondary loop on a *single page
template*? For example, on a single page template can I have a URL like
below:
http://localhost/artist/artist-name/page/2
Here is the link for:
single-artist.php <https://gist.github.com/iammahmudur/19d944872cfac1c285cf>
loop-artist.php <https://gist.github.com/iammahmudur/8f38979f143cdc668ff9>
Pagination code on functions.php<https://gist.github.com/iammahmudur/5881276>
Many thanks.
On Thu, Jun 27, 2013 at 11:38 PM, J.D. Grimes <jdg at codesymphony.co> wrote:
> Have you tried get_query_var( 'paged' ) instead?
>
> - J.D. Grimes
>
> On Jun 27, 2013, at 5:07 AM, Md Mahmudur Rahman <iammahmudur at gmail.com>
> wrote:
>
> > Hello Hackers,
> >
> > I'm using Posts 2
> > Posts<http://wordpress.org/extend/plugins/posts-to-posts/description/>
> > plugin
> > 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
> > working.
> >
> > // 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:
> >
> > *single-artist.php<
> https://gist.github.com/iammahmudur/19d944872cfac1c285cf>
> > *
> >
> > 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
> > clue.
> >
> > --
> > *Many thanks*
> > *
> > *
> > *Mahmudur Rahman*
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
--
*Many thanks*
*
*
*Md Mahmudur Rahman*
More information about the wp-hackers
mailing list