WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
[resolved] Is there a way to retrieve just a counter of connected post? (4 posts)

  1. carletto0282
    Member
    Posted 1 year ago #

    As I said in the title there is a way to show up just the number of connect posts?

    Thanks
    Best Regards
    Carlo

    http://wordpress.org/extend/plugins/posts-to-posts/

  2. scribu
    Member
    Plugin Author

    Posted 1 year ago #

    Each WP_Query instance contains a property called found_posts, which shows the total number of items (ignoring pagination). So, you could do this:

    $connected = new WP_Query( array( 'conencted_type' => ... ) );
    
    $total = $connected->found_posts;
  3. hept27
    Member
    Posted 1 year ago #

    What about in the instance of related posts when there doesn't appear to be a WP_QUERY?

    $related = p2p_type($connected_type)->get_related( get_queried_object_id() );

    THANKS!

  4. scribu
    Member
    Plugin Author

    Posted 1 year ago #

    get_related() does return a WP_Query instance.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic