- This topic has 3 replies, 2 voices, and was last updated 1 year, 8 months ago by .
-
Topic
-
Hi,
I want to only show a specific custom post type (resort) if it has a connected CPT (Accommoation)
$resort_args = array( 'post_type' => 'resort', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => '_resort_country', 'field' => 'id', 'terms' => $country->term_id ), ), 'relationship' => array( 'id' => 'accommodation_to_resorts', 'compare' => 'EXSISTS', //This is an example not working ), );
MB_Relationships_API::register( array( 'id' => 'accommodation_to_resorts', 'from' => array( 'object_type' => 'post', 'post_type' => 'resort', 'meta_box' => array( 'hidden' => 'true', ), ), 'to' => array( 'object_type' => 'post', 'post_type' => 'accommodation', 'meta_box' => array( 'title' => 'Resort', 'context' => 'side', 'empty_message' => 'No resorts.', ), ),
Thanks in advanced
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.