I finally got around to hacking the Related Posts plugin for WordPress. I love the plugin, but on some posts it listed pages like my contact form or email newsletter confirmation as related pages. None of my "pages" are related to any of my posts and I don't want my pages listed as related to my posts.
I looked on the Wasabi site (home of the Related Posts plugin), but didn't find anything other than a comment from someone with the same problem. The question was posted three months ago and it was never answered. So, I looked at the plugin code and came up with a quick solution.
To disable pages in your related results, just follow these five steps:
- Log into the admin area of your WordPress blog.
- Click on Plugins, then click on Plugin Editor.
- On the right is a list of your plugin files. Click on Related Posts.
-
In the Editing related-posts.php text window, scroll down until you find this line:
. "AND (post_status IN ( 'publish', 'static' ) && ID != '$post->ID') ";
Its almost half way down (its a few line below // Primary SQL query). If you are using Windows, you can do a search by hitting ctrl-F and searching for static. It's line 92 if you are using a text editor on your computer.
Change 'publish', 'static' to just 'publish'
Static refers to pages and publish refers to posts. The new line should read:. "AND (post_status IN ( 'publish' ) && ID != '$post->ID') ";
- Click the Update File button and you are done.
That's it. Your pages will no longer be listed as related to any of your posts.
Free Magazines : : Find a Job : : iZachy : : Daddy Forever : : Embedded Star : : EDA Geek : : EDA Blog : : FPGA Blog
© 2006 Online Destiny Ltd : : iZachy is a trademark of Online Destiny Ltd