Forum
Show related blog posts with the same tag
My client would like their blog to display related articles under each blog post. All their posts are tagged. Is there a way to display posts that share the same tag below an article, say with the post title and image?
Thanks!
You can use
perch_blog_custom()
to filter by thepostTags
field where itcontains
another tag.Ah, that would work. What would I put in for value, however?
<?php perch_blog_custom(array( 'filter' => 'postTags', 'match' => 'contains', 'value' => '', )); ?>
Thanks!
Any of the tags you want to match against - so the tags from the current post.
Drew,
Not sure I follow. I don't know what a particular blog entry is tagged as--that's up to my client when they submit a new entry. The above solution needs a way of displaying only those blog entries that share the same tag. But I'm not sure how I express that condition in the code since the perch_blog_custom function needs to work with any tag my client chooses to use. I hope that makes sense.
You can use
perch_blog_custom()
with theskip-template
option to get the tags for the current post.Solved.