I've set up two different custom post types – one for categories and one for posts. I've attached the posts to the categories with the CMB2 plugin. I now want to display all the attached/related posts on each category page. I'm able to display the different ID's from the array, but not the post content.
Trying to get attached posts:
$attached_users = get_post_meta( get_the_ID(), 'pr2_cmb2_attached_posts', true );
foreach ( $attached_users as $user ) {
$employee = get_post( $user );
}
Trying to display the content from the attached posts
<?php while ( have_posts() ) : the_post(); ?>
<?php echo get_the_title($employee);?>
<?php echo get_the_post_thumbnail($employee);?>
<?php endwhile; // end of the loop. ?>