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

Md Mahmudur Rahman iammahmudur at gmail.com
Fri Jun 28 00:36:43 UTC 2013


Hi,

This is now working. I have changed the arguments for my second query as
given below:

// 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,
) );

Thanks for your help.

Cheers.

Mahmudur

On Fri, Jun 28, 2013 at 10:24 AM, Md Mahmudur Rahman
<iammahmudur at gmail.com>wrote:

> Hi
>
> If I set the page number as a GET parameter then it works for the first
> loop/primary loop and not for the secondary loop. As a result the URL
> becomes:
>
> http://localhost/artist/artist-name/2/<http://localhost/artist/artist-name/?page=2>
>
> Here is the response (WP_Query Object) for the first loop:
>
> https://gist.github.com/iammahmudur/88beda1b000acd806144
>
> And here is the response (WP_Query Object) for the second loop:
>
> https://gist.github.com/iammahmudur/2b526713a14fb3b8fd05
>
> How can I set the 'page' parameter for the second loop?
>
> Many thanks.
>
> On Fri, Jun 28, 2013 at 9:57 AM, J.D. Grimes <jdg at codesymphony.co> wrote:
>
>> Does it work if you add the page number as a GET parameter?
>>
>> For Example, http://localhost/artist/artist-name/?page=2
>>
>> -J.D. Grimes
>>
>> On Jun 27, 2013, at 7:37 PM, Md Mahmudur Rahman <iammahmudur at gmail.com>
>> wrote:
>>
>> > 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:
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> *Many thanks*
> *
> *
> *Md Mahmudur Rahman*
>



-- 
*Many thanks*
*
*
*Md Mahmudur Rahman*


More information about the wp-hackers mailing list