I will assume that you(or users) will enter post ids into a posts custom field, comma separated, eg: 11,13,34,54
OR 11, 13, 34, 54
.
Then all you need to do is get the custom field value for the loaded post, explode the custom field value by comma(,): and, then you'll have a nice array to pass into the include
parameter. Here is an example showing the important pieces:
<?php
$postIds = get_post_meta($post->ID, 'postIds', true); // get custom field value
$arrayIds = explode(',', $postIds); // explode value into an array of ids
if(count($arrayIds) <= 1) // if array contains one element or less, there's spaces after comma's, or you only entered one id
{
if( strpos($arrayIds[0], ',') !== false )// if the first array value has commas, there were spaces after ids entered
{
$arrayIds = array(); // reset array
$arrayIds = explode(', ', $postIds); // explode ids with space after comma's
}
}
$args = array(
'include' => $arrayIds // pass array of ids into `include` parameter
);
...
?>