Plugin Recommendations are considered off-topic here. One solution could be to add a metabox to your post like so:
Add to Functions.php
/** Add Post Metabox **/
function add_custom_meta_box() {
add_meta_box(
'pick_post', // $id
'Pick Post', // $title
'show_custom_meta_box_pick_post', // $callback
'agenda', // $page
'side', // $context
'high'); // $priority
}
add_action('add_meta_boxes', 'add_custom_meta_box');
/** Post Metabox Callback (show some stuff in box) **/
function show_custom_meta_box_pick_post() {
$doelArr = get_posts( array( 'post_type' => 'doel', 'orderby' => 'title', 'order' => 'ASC', 'posts_per_page' => -1 ) );
$meta_doel = get_post_meta($post->ID, '_doellist', true);
?>
<input type="hidden" name="info_meta_box_nonce" value="<?php echo wp_create_nonce(basename(__FILE__)); ?>" />
<strong>Associated Doel</strong>
<br />
<select id="selectdoel" name="_doellist">
<option value="">Select Doel</option>
<?php foreach($doelArr as $doel) : setup_postdata( $doel ) ?>
<?php if($doel->ID == $meta_doel) : ?>
<option value="<?php echo $doel->ID; ?>" selected="selected"><?php echo $doel->post_title; ?></option>
<?php else : ?>
<option value="<?php echo $doel->ID; ?>"><?php echo $doel->post_title; ?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
}
/** Save Our Meta-data **/
function save_custom_meta($post_id) {
global $post;
// check autosave
if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (!current_user_can('edit_post', $post_id)))
return $post_id;
if($post->post_type == 'agenda')
{
// Doel Selection List Check
if(isset($_POST['_doellist']) && $_POST['_doellist'] != '')
update_post_meta($post_id, '_doellist', strip_tags($_POST['_doellist']));
else
delete_post_meta($post_id, '_doellist');
}
}
What this does is create a small metabox with a dropdown of Doel posts - then saved the Doel Post ID as a meta value. You can get that meta-value (Doel Post ID) at any time by passing in the Agenda ID to get_post_meta()
function.
$meta_doel = get_post_meta($post->ID, '_doellist', true);
Then you could get the entire Doel post like so:
$doel_post = get_post($meta_doel);