I have had another look and I can only associate tags with this type of custom post (learndash topics). So instead of categories I think I would need to be able to not display related content based on a post having a certain tag.
Hi stug2013. This thread discusses using the Tag option to filter posts, and excluding posts by category. Not sure how you’re filtering the Related Posts but this might give you an idea of how to accomplish your objective.
Hi bdbrown thank for the pointer but I think this is a different type of fix to the one I need. I think my explanation above is probably a bit sketchy.
The situation is this. For all my posts so far I like to have the related post shown at the bottom, which I have set in theme options. However now I have a particular custom post type that I don’t want any related posts shown at all. I am trying to figure a way to achieve this. I thought I might be able to identify this custom post type by assigning a specific category to it but for some reason you can only add tags. Not sure if this is the direction to go anyway.
glad of any other ideas
OK, think I’ve got it. Since you don’t want to display the Related Posts at all for that post type, maybe a better approach would be to back up a level and catch the call at the point of origin in single.php. If you copy single.php to your child theme you’ll find these three lines at the bottom of the file:
<?php if ( ot_get_option( 'post-nav' ) == 'content') { get_template_part('inc/post-nav'); } ?>
<?php if ( ot_get_option( 'related-posts' ) != '1' ) { get_template_part('inc/related-posts'); } ?>
<?php comments_template('/comments.php',true); ?>
Wrap the second line with a test for the post type:
<?php if ( ot_get_option( 'post-nav' ) == 'content') { get_template_part('inc/post-nav'); } ?>
<?php if ( get_post_type() != 'custom_post_type' ): ?>
<?php if ( ot_get_option( 'related-posts' ) != '1' ) { get_template_part('inc/related-posts'); } ?>
<?php endif; ?>
<?php comments_template('/comments.php',true); ?>
Change ‘custom_post_type’ to your post type. Try that and see how it works.
Thanks a million bdbrown, works perfect!!