WordPress.org

Support

Support » Plugins and Hacks » Posts 2 Posts » [Resolved] [Plugin: Posts 2 Posts] Grab connect meta information when displaying queried results

[Resolved] [Plugin: Posts 2 Posts] Grab connect meta information when displaying queried results

  • I’m showing of a custom post type (products) on a page – that I’m already querying to use targeted queries based on URL calls.

    if(isset($_GET)) $options = $_GET;
    $posts = new WP_Query( array(
    'post_type' => 'product',
    'showposts' => 30,
    'orderby' => $options['orderby'],
    'order' => $options['order'],
    'paged' => $paged,
    'developer' => $options['developer'],
    ));

    I want to do two things.

    1) Pull out connected meta information for each of the posts matching this query.

    2) Add another layer to this query and sort by a connected meta query (in this case “rating”). So in essence it would display all of the products in order of their rating.

    How would I go about achieving this?

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

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

    @scribu

    It’s a WP_Query instance: just use the normal ‘orderby’ => ‘meta_value’ parameter, described in the Codex.

    Same for retrieving meta: just use get_post_meta(), like for any other post.

    Also note that assigning a WP_Query instance to a variable called $posts might get confusing. Use $query or something like that.

    I tried to query using: 'connected_type' => 'review_to_game', 'connected_items' => $post
    but it returned no results…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] [Plugin: Posts 2 Posts] Grab connect meta information when displaying queried results’ is closed to new replies.
Skip to toolbar