Support » Plugins and Hacks » Posts 2 Posts » get_related duplicate post

get_related duplicate post

  • Lui Amisola


    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 4

    My Code:

    // 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>
    <?php while ( $related->have_posts() ) : $related->the_post(); ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; ?>
    endif; wp_reset_postdata();

    Please help me. Thank you.


Viewing 1 replies (of 1 total)
  • I think you have the same item connected 2 times, maybe with 2 different services.

    On the other hand, I want yo know if you are able to show more than 4 items. Me not 馃檨

Viewing 1 replies (of 1 total)
  • The topic ‘get_related duplicate post’ is closed to new replies.
Skip to toolbar