get_related duplicate post
-
I recently been using Posts 2 Posts and I’m so glad that I have discovered this plugin.
My problem is on get_related, using the actual loop/code on the wiki docs. Some of the post on the loop are duplicates.
Related Items:
– Item 1
– Item 1
– Item 2
– Item 3
– Item 4My Code:
<?php // Find connected pages $related = p2p_type( 'consultant_to_service' )->get_related( get_queried_object() ); // Display connected pages if ( $related->have_posts() ) : ?> <h3>Related Consultant:</h3> <ul> <?php while ( $related->have_posts() ) : $related->the_post(); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> </ul> <?php endif; wp_reset_postdata(); ?>
Please help me. Thank you.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get_related duplicate post’ is closed to new replies.