I have two custom post types called actors and movies. In movies, I have a custom meta box that got data from actors post type.
When an actor is selected in movie post, the values (post_id, meta_key and meta_values) are stored in postmeta table.
So I build a page to show all movie info. Fot that, I'm using WP_Query:
<?php $args_movie = array('post_type' => 'movie','posts_per_page' => -1); $movie_posts = new WP_Query($args_movie); if($movie_posts->have_posts()) : while($movie_posts->have_posts()) : $movie_posts->the_post(); ?> <h2><?php the_title() ?></h2> <?php endwhile; else: ?> Oops, there are no posts. <?php endif; ?>
This works fine for me. Now I'm trying to show all actors associated with each movie. This script return an array of IDs:
$actors= get_post_meta( get_the_ID(), 'actors'); print_r($actors);
But how can I using this array to get actor's titles?
$args = array('post_type' => 'actors','orderby' => 'ASC','post__in' => $areas);