[wp-hackers] Two loops

Josh Eaton josh at josheaton.org
Sun Nov 17 20:41:41 UTC 2013


This question is probably better suited for the support forums or WordPress
Answers http://wordpress.stackexchange.com/

Regardless, you're likely missing a wp_reset_postdata() after the related
loop to reset the $post global.


On Sun, Nov 17, 2013 at 12:44 PM, Aero Maxx <aero.maxx.d at gmail.com> wrote:

> On 17/11/2013 00:11, hamlet wrote:
>
>> Hello, I am the following issue:
>>
>> I am using a custom post type (it has support for comments)
>> single-myPostType.php
>>
>>         if ( have_posts() ) {
>>             while ( have_posts() ) {
>>                 the_post();
>>
>>                 get_template_part('content', 'single-myCustomPostType');
>>
>>                 comments_template('', true);
>>             }
>>         }
>> content-single-myCustomPostType.php
>>
>> (...)
>>       $loop = wp_get_the_related(get_the_ID());
>>       if ($loop->have_posts())
>>         while ($loop->have_posts()) {
>>           $loop->the_post();
>>           get_template_part('content', 'related');
>>         }
>> (...)
>>
>> It is getting comment forms if some related has this options enabled. Any
>> idea?
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
> I'm happy to try and help you, but I read what you wrote 2-3 times and I
> didn't understand what it was you was trying to explain, are you saying you
> have a custom post type, and its showing the post but not the comment form,
> or that its only showing the comment form when it has a post that is
> related to the post being viewed ?
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list