Over the last few days, I’ve been working with the GothamSchools editors to come up with a way of displaying related stories to readers. Here is what we’ve come up with:
To accomplish this I started with the same related posts plugin we use on Streetsblog: Yet Another Related Posts Plugin. This is really an excellent plugin that crunches masses of data to come up with a useful list of related posts for any given post. By default, it can show this list at the bottom of a post before the comments, or in a sidebar widget. We soon decided that we didn’t like these options and instead crafted a widget that floated within the story itself.
I did this by searching for a “more” tag within the content of the post using the WordPress the_content filter. If it exists, I inserted the widget there so it appears mid-way through the post. If it doesn’t exist, then I float the box at the bottom of the post.
Occasionally, we have stories that are composed of images and videos such that the “Related Stories” box would not fit anywhere nicely. In this case, I made an option to turn off the box entirely for that post:
Unfortunately to accomplish these modifications, I had to edit the plugin code directly. This will make upgrading more difficult. Perhaps the plugin author may want to incorporate some of my modifications into future releases of the plugin. For that reason, I point to the code.