Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

jacob0601 on "Related Posts by Multiple Tags"

$
0
0

I was curious if was possible to display related posts by multiple tags.

The site I am working on has about 5 tags per post. Most posts have 1 or 2 tags in common. The related posts I'd like to show have 3-5 tags in common. I would link the site, but this is all locally developed with mamp.

So, I'd like the related posts to function by looking for posts with the most number of tags in common and display them in descending order.

Let's say I display 3 related posts: relatedpost1 would have 4 tags in common, relatedpost2 would have 3 in common and relatedpost3 would have 1 in common.
Is it even possible to do this?

Right now I am messing around with two ways of displaying the posts but they arent functioning as I'd like:

The first method (code here: http://codepad.org/K9UGSYuc) just shows posts with ANY tags in common.

The second method (code here:http://codepad.org/ZGrzMXIE) just shows posts with the first tag in common.

I'm either getting pretty random posts displaying (since most of my posts have at least 1 tag in common) or (for some posts) getting no related posts (since their common tags are tag 4 or 5).

Any help would be greatly appreciated.


Viewing all articles
Browse latest Browse all 8245

Trending Articles