Actually it may be better to display the manual posts first, then query with YARPP with ‘post__not_in’ to exclude them.
I will prob modify the plugin to do this for now.
Thanks
Modified class-cache:
$options = array( 'threshold', 'show_pass_post', 'past_only', 'weight', 'require_tax', 'exclude', 'recent', 'limit', 'post__not_in' );
// WHERE
$newsql .= " where post_status in ( 'publish', 'static' ) and ID != '$reference_ID'";
if ($post__not_in)
$newsql .= " and ID not in (".join(',', $post__not_in) .")";
Modified call:
yarpp_related(array(
'post__not_in' => array(270),//ignore posts
...
));
Thanks for taking a deep dive into YARPP! 😀
I did something like this for a client, without modifying the YARPP core code. You can simply use the the_posts filter and make sure you’re only modifying the output when it’s a YARPP loop.
Something like:
add_filter( ‘the_posts’, ‘yarpp_add_entries’, 10, 2 );
function yarpp_add_entries($posts, &$query) {
global $yarpp;
if ( !$yarpp->cache->is_yarpp_time() )
return $posts;
// check query vars for reference_ID
// construct extra posts as array, using get_posts()
$extra_posts = get_post( $special_query );
return array_merge($posts, $extra_posts);
}
Hope that helps!
In addition, if you’re looking to exclude certain posts in your output, I suggest you do that using a YARPP custom template: just check the IDs in the template, and not print the output if it’s one of the ones you want to exclude.