WordPress.org

Support

Support » Plugins and Hacks » Posts 2 Posts » [Resolved] [Plugin: Posts 2 Posts] Is there a way to retrieve just a counter of connected post?

[Resolved] [Plugin: Posts 2 Posts] Is there a way to retrieve just a counter of connected post?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author scribu

    @scribu

    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;

    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!

    Plugin Author scribu

    @scribu

    get_related() does return a WP_Query instance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] [Plugin: Posts 2 Posts] Is there a way to retrieve just a counter of connected post?’ is closed to new replies.
Skip to toolbar