I’ve always liked the idea of having related entries shown - it’s a smart system of navigation and helps explore the knowledge available. Hence the first plugin I installed on this Wordpress-based blog was Related Posts by Alexander Malov & Mike Lu.
The aim behind the related posts plugin is to show similar entries already made on your blog, regardless of their category. Think of it as displaying search results before the reader has searched. That’s how useful it can be if it works.
However, the Wordpress plugin did not give very good results when used on this site. Upon investigating the code, I discovered it was only using the post’s URL to compare the current post with other entries. Since my weblog URLs are based on the page title, which on this site doesn’t always highlight keywords from the entry, this was unsurprisingly not proving effective.
The plugin provided the option for you to put hidden keywords in your post which would be used. However I didn’t want to go back and add keywords to my old posts. Not to mention I’d forget the standard keywords between writing posts
Tagging is a job for the computer, not a human…
So I’ve hacked up a modified version, which takes the post content, and calculates word frequency using weightings that can easily be modified (lines 57-62 of the code) for different parts of the post (eg URL, title, content). It then uses these details to match against the MySQL full-text index, (hopefully) returning more relevant results.
The script currently does not use any stemming algorithm or match against category IDs. Those are the most obvious features to add but the latter would require the MySQL query being reworked, and it was bedtime!
If you want to see the MySQL full-text ranking (as shown on this site next to each related posts link at present on this blog) to give you an idea of the certainty of each match being shown, uncomment line 161 in related-posts.php.
The code is not supported and was hacked because I was curious about recommendation algorithms. Improvements or suggestions are welcome. You are free to use and modify this code.
Question: Is there some way to manage file uploads like above from within Wordpress? I’ve uploaded it manually as the ‘upload’ box on the “Write Post” screen said a php file wasn’t a valid image!
49 comments ↓
Peter,
Two quick things…
1) To answer your question, if you install the Mime-config plugin you should be able to add PHP files to the system so that you can upload them using the built in upload funcationality.
2) On my site I’m using the Ultimate Tag Warrior plugin and I’ve gone to great pains to go back and tag all of my posts with key words. I wonder if there would be a way for your hack to also take these into consideration?
Personally, I think that words found in the title and the UTW tags should carry considerably more weight than other words in the content, but it sounds like a good idea for everything to be considered.
Finally, the link to the original Related Posts plugin in down, so I wonder if you could describe the usage of your version of the plugin?
Thanks,
John
Thanks John, I’ll upgrade to 2.1 first and then install that plugin if they haven’t dealt with it in the core.
As to UTW, yes if the keywords are in a separate database field then it’ll be fine to put great weighting on them. If you look at the source of my modified plugin, there’s a lot of commenting around the weighting algorithm, which should help to adjust it. Mine is very crude (though less crude than the origianl) - FWIW the title should already have a double or triple weighting.
I’m afraid I’ve no clue about its usage - drop it with the original files in the plugins directory I imagine and then activate it. Sorry - I hope the original page comes back up!
Kind regards,
Peter
Peter,
This plugin (written by a priest named Rob Marsh) seems to do what you are after:
http://rmarsh.com/plugins/similar-posts/
You don’t say anywhere how to use the plug-in, it’s ok for the likes of me because I can look through your code and find the function I need to call. But for the casual blogger they wouldn’t have a clue. You need to modify your post with usage.
Simon,
I didn’t provide any usage instructions as they were on the original site, which the modified code was supposed to complement rather than replace. Now that site’s disappeared I’ll have a dig and see if I can find any…
I can help you out there:
Usage of WP_Related-posts Plugin.
Default include,
into your template file where you want the plugin to show. Edit the plugins default options under the plugins >> Related Posts Options in your wordpress admin window.If you wish to override the default options when including in a template then use the following hierarchy when calling the function:
related_posts($limit=5, $len=10, $before_title = '', $after_title = '', $before_post = '', $after_post = '', $show_pass_post = false, $show_excerpt = false);$limit = Number of related posts to return.
$len = Length of excerpt to show if excerpt is set to true.
$before_title = What to display before each related post, I use li tags as they allow for easy styling.
$after_title = Same as before title just after it.
$before_post = What to display before each excerpt.
$after_post = What to display after each excerpt.
$show_pass_post = Show passworded posts.
$show_excerpt = If set to true, show an excerpt of the post limited to the length set by $len.
Hope that helps
Ah i forgot to remove the related_posts() wrapped in php include tags.
Excellent - thanks Simon!
Hi Peter. I just thought that I’d drop a quick note to you, as I’d been looking for an alternative to what I had been using. I noticed that no one has pointed out the new link for the original Related Posts plugin, so here it is:
http://wasabi.pbwiki.com/Related%20Entries
Just what I needed, thanks for the great job
I’m confused, so we copy what Simon has posted out of own related posts file into our template for it work without the php code or what?
[...] them a list of related posts at the end of each blog post. You can accomplish this by using the modified Related Posts plugin from Peter Bowyer. He has enhanced the original plugin by Alexander Malov & Mike Lu [...]
[...] Comment: You can find the plugins here, here and here [...]
[...] related_posts [...]
[...] Visit [...]
[...] wtyczk mona pobra ze strony http://peter.mapledesign.co.uk/weblog/archives/wordpress-related-posts-plugin, skopiowa ten plik do katalogu wp-content/plugins, a nastpnie wczy (wtyczki -> related posts [...]
[...] If you’d want a more advanced and more accurate Related Entries plugin you can use the hacked version by Peter Bowyer, that has messed around with the original code and made it take in consideration tags as well, so [...]
[...] Atualizei o plugin que gerava uma lista de posts relacionados ao final de cada post. O plugin antigo gerava uma lista [...]
[...] ogni post e, se non si è soddisfatti del suo operato, si può ricorrere alla versione di Peter Bowyer che dovrebbe ridurre i margini di errore nella correlazione tra vari [...]
[...] sotto ogni post e, se non si è soddisfatti del suo operato, si può ricorrere alla versione di Peter Bowyer che dovrebbe ridurre i margini di errore nella correlazione tra vari [...]
[...] oben beschriebene Similar Posts basierte ursprünglich darauf. Von Peter Bowyer gibt es zudem eine modifizierte Version. [...]
[...] instala el plugin para mostrar Entradas Relacionadas, este que recomiendo es una modificación del original para trabajar mejor con sitios en español. De todas formas la implementación del mismo puede [...]
[...] Related Posts Plugin (YARPP1) 1.0 for WordPress. It’s the result of some tinkering with Peter Bowyer’s version of Alexander Malov & Mike Lu’s Related Entries plugin. Modifications made [...]
I see the my comments show wrong.
Correction:
Here is
Hi. I’m glad to you publish this plugin..
But, I want to the related post plugin don’t show the after more tags of posts.
How can I do this?
Hi Peter. Thanks for this absolutely excellent plugin!
My questions:
1. Does this work with WP 2.3 (before I screw up my production sites)?
2. Has anyone tried this with the “Similar Posts” plugin and compared the performance or accuracy? http://rmarsh.com/plugins/similar-posts/
Thanks!
I think this is a good effort but the “Similar Posts” plugin is a godsend. It just works, the options are clear and concise, and the code is squeaky clean. For anyone who’s grappling with this plugin (as I was).
[...] 2.0.4. Updated at 11:26 am on 20 Feb 2008 Just found an “improved version” of the Related Entries plugin by Peter Bowyer. Just overwrite the exisitng relate-posts.php with the one you download from Peter’s [...]
[...] have done it for this blog. I used the Peter Bowler’s version of Related Post. It works. See [...]
Hmmm. I tried to “override” the default (I have set up in the options page) of 5 items to 3 items using the parameters. Didn’t seem to work. I still get 5 items even though I set the parm to $limit=3. I’m not sure what I’m doing wrong.
[...] uses a different technique. He gratefully acknowledges the work of several people, Peter Bowyer, Alexander Malov, and Mike Lu. The key part of this plugin is the algorithm to identify related [...]
[...] Related Posts Plugin - wtyczka ta poprawi nam wewnętrzne linkowanie i dodatkowo zróżnicuje treść. Wtyczka wymaga trochę więcej umiejętności od nas, będziemy musieli wyedytować skórkę wordpressa, prawdopodobnie będzie to plik single.php i po kodzie <?php the_content(’Czytaj dalej »’); ?>, wstawić <?php related_posts(5, 10, ‘<li>’, ‘</li>’, ”, ”, false, false); ?>. Do poprawnego działania należy także wykonać zapytanie sql do bazy danych: ALTER TABLE `wp_posts` ADD FULLTEXT `post_related` ( `post_name` , `post_content` ) Jeżeli nadal będziecie mieli trudności z instalacja wtyczki, przeczytajcie instrukcję dostarczona razem z wtyczką, instrukcja jest po angielsku, ale nawet osobom nie znającym języka powinna wydać się zrozumiała. [...]
[...] Related Posts - This plugin is a very useful plugin. It shows similar posts already made on your blog, regardless of their category thereby makes readers read other posts that are related to the current post. It is also one of the SEO (Search Engine Optimization) plugin because, it increases internal linking on your blog. After few days i found an “improved version” of Related Entries plugin by Peter Bowyer. [...]
[...] Download Link: http://wasabi.pbwiki.com/Related%20Entries Modified versions of the same plugin: http://peter.mapledesign.co.uk/weblog/archives/wordpress-related-posts -plugin [...]
[...] Related Posts Plugin - wtyczka ta poprawi nam wewnętrzne linkowanie i dodatkowo zróżnicuje treść. Pod każdym wpisem będzie wyświetlała się wybrana ilość linków do innych wpisów. Jeśli chodzi o linkowanie to super sprawa. Umieszczając ten plugin trzeba zmodyfikować nieznacznie kod skórki Wordpressa i dodać zapytanie do bazy, nie będę tu opisywał szczegółów, bo wszystko opisano w instrukcji. [...]
[...] Another Related Posts Plugin Yet Another Related Posts Plugin is the result of some tinkering with John Bowyer’s version of Alexander Malov & Mike Lu’s Related Entries plugin. Modifications made [...]
Help! Mine says “no related posts” ? How can this be? I thought maybe it had to be manually installed so I’m trying to follow the directions:
(from the wiki: http://wasabi.pbwiki.com/Related%20Entries)
” 4. If automatic creation of a full text index fails. You will have to set it up manually. Don’t worry it’s not hard. Just open your database in phpMySQLadmin and run the following command (cut & paste):
ALTER TABLE `wp_posts` ADD FULLTEXT `post_related` (
`post_name` , `post_content`
)”
but there is an extreme lack of direction! Like, post it where!? I don’t know where to put this!? and it took me like forever to figure out what simon posted here needed to in reality have the php call around it! I’m not a programmer I’m trying my best to understand this but I need better directions then this!
[...] Related Posts - выводит список релевантных записей. Этот плагин очень важен т.к. обеспечивает отличную внутреннюю перелинковку. После активации в разделе Плагины появиться раздел Related Posts Options. В графе How many related posts would you like to show ставим 7, опыт показал что 7 ссылок на релевантные записи дают наибольший эффект. В Before / After (Post Title) согласимся с рекомендациями и ставим <li> и </li>. После этого сохраняем настройки и жмем на ссылку this script которая находиться внизу страницы. Вполне вероятно, что скрипт выдаст ошибку “Sorry, you must be at least a level 8 user”. Чтобы этого не было нужно закомментирвоать 20-ю и 21-ю строки плагина. //if ($user_level < //die (”Sorry, you must be at least a level 8 user.”); // Make sure that user has sufficient priveleges В шаблоне “Одна страница” перед <?php comments_template(); ?> добавляем <?php related_posts(); ?>. [...]
interesting and great. Good job
[...] Peter Maple Design - WordPress Related Posts Plugin [...]
[...] Install the related posts plugin. In addition to showcasing your best posts, you want to give people an opportunity to check [...]
[...] il related posts in modo da offrire altre informazioni utili ai vostri [...]
Oh… I can’t install…
There is dump error
I have been using “Yet Another Related Posts Plugin Options 2.1.6″ for 4 months and I really appreciate your efforts for creating such a fabulous Plug-in.
Now, I have a question. How can I use this plug-in to display related posts from my other blogs (as I have 4 different wordpress blogs)?
Can you please guide me?
Regards,
Najam
[...] Related Posts Выводит ссылки на “похожие записи”. Плагин очень полезен как для людей, так и для поисковых машин, т.к. организует дополнительную перелинковку на записи внутри блога. [...]
[...] Related Posts (modified) – русская версия популярного плагина, показывающего похожие статьи в конце каждого поста. Настраивается с трудностями, выводит не всегда то, что кажется логичным, но пока что единственное решение внутренней перелинковки страниц между собой, и эту функцию выполняет на 5. Однозначно must have! [...]
[...] Related Posts. Этот плагин добавляет после каждой записи блок с [...]
Thank you SO MUCH for this. The latest version of the plugin would not display any posts and I spent literally 6 hours (midnight to now) attempting to troubleshoot. Oh my god. Finally, this works. THANKS!!!!
sidenote: forced to use it with the theme I purchased.
[...] нравится. Следующим был плагин для перелинковки: WordPress Related Posts Так же в настройках выставляем нужные параметры. [...]
[...] Peter Maple Design – WordPress Related Posts Plugin [...]
Leave a Comment