简体   繁体   中英

PHP wordpress style related posts

Do you know how wordpress decides which related posts to show?I mean I know if it has tags, then it's easy but if it doesn't?

Best Regards,

Generally the 'related post' function of a Wordpress Blog is created by the owner of the blog, or using a plugin. I can imagine that those plugins either look for new posts with similar tags or in the same category as the post it is displaying.

As far as my knowledge extends, I do not believe that Wordpress has a show_related_posts function, although I may be wrong. If it does, it would be simple enough to look it up on the documentation at wordpress.org.

Also, another good part about OpenSource programming is that you can simply go in and look at any of the code that you are curious about. I personally use Notepad++, and when I find a function in Wordpress or any other CMS I am not famillar with, I simply copy and paste the function name, and do a Multi-File search on the function to figure out where it is declared.

I'm going to have to go with Chacha102, as far as I know this can only be done using plugins or by hacking the code yourself.

I did something similar by falling back on the post's category if it had no tags, works pretty well too.

This guy has the leading plugin for related posts. I'd download that and take a peek at his code and see how he does it. Then you can reverse engineer it and make it your own. The beauty of opensource.

http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM