How are related posts determined, and how to hide "no related posts found"? #869
Unanswered
rolandixor
asked this question in
Q&A
Replies: 3 comments 2 replies
-
It display related article based on category. To remove the default use similar trick with this one #855 (comment) |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm assuming we can pull from tags then? P.S. is it possible to assign a post to more than one category? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Something like this could work? <?php $related = get_related($post->related, true); ?>
<?php if (!empty($related)): // Check if $related is not empty ?>
<?php foreach ($related as $r): ?>
<h3><?php echo $r->title; ?></h3>
<!-- Other content for each $r -->
<?php endforeach; ?>
<?php else: ?>
<p>No related items found.</p>
<?php endif; ?> |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to hide the related posts if there's nothing there. How would I go about doing this in my theme?
Also, how are related posts determined?
Beta Was this translation helpful? Give feedback.
All reactions