Plugin Author
YARPP
(@jeffparker)
@sxn31 have you looked at the yarpp_related() function and/or YARPP shortcode?
For example, you can do:
[yarpp exclude="1,2,3"] - exclude posts with categories with IDs 1,2 and 3
All the parameters accepted by yarpp_related() can also be used in the shortcode.
https://ww.wp.xz.cn/plugins/yet-another-related-posts-plugin/#installation
Thread Starter
sxn31
(@sxn31)
I hadn’t seen that, thanks that points me in the right direction, however:
Do you have any mechanism for getting related posts via a custom field?
I have post types like so:
I link characters to game via a relationship advanced custom field so YARPP doesn’t see them as related. I’ve been writing custom code to generate my own related posts by looping through the meta_query to get my particular key-value pair, but if YARPP can do it instead that would work better for me.
Plugin Author
YARPP
(@jeffparker)
Is this relevant?
From https://ww.wp.xz.cn/plugins/yet-another-related-posts-plugin/#how%20to%20add%20support%20for%20a%20custom%20post%20type%20%28cpt%29%3F
How to add support for a Custom Post Type (CPT)?
To make YARPP support your Custom Post Type (CPT), the attribute yarpp_support must be set to true when the CPT is registered. The CPT will then be available in the YARPP settings page.
‘yarpp_support’ => true
For example:
function register_my_cpt() {
$args = array(
‘public’ => true,
‘label’ => ‘Books’,
‘yarpp_support’ => true,
);
register_post_type( ‘book’, $args );
}
add_action( ‘init’, ‘register_my_cpt’ );
Thread Starter
sxn31
(@sxn31)
No I was already able to get custom post types to work, it was leveraging custom fields to show related posts where I was getting stuck.