WordPress Neighbor Post Preview

This WordPress Plugin gives you a preview when you hover on the previous/next links in a single post page. In the preview area, the excerpt of the corresponding post is shown. You can open any post on this site to see the effect in action.

WordPress Neighbor Post Preview

Compatibility

It should work with WordPress versions 1.5 and later. But currently I only tested it with 2.3.2, so I need some feedbacks about this :)

Download

Download:Latest Version (1.1.0).

Installation

  1. Download the plugin and extract it.
  2. Put the plugin folder (neighbor-post-preview) into your WordPress plugin directory.
  3. Activate the plugin through the “Plugins” menu in WordPress admin area.
  4. Modify single.php file of your current theme. Find previous_post_link(…) and replace the function name by tlnpp_previous_post_link. Also replace function next_post_link by tlnpp_next_post_link.

Now go to a single post page and hover on the navigation links to see if it works.

Customization

Go to Neighbor Post Preview Options page in WordPress admin area (Options -> Neighbor Post Preview) and you’ll see 3 options to customize:

  • Excerpt length. How many words do you want to display when there is not an explicit excerpt?
  • Delay before hide. How long will the preview stay after your mouse leaves the link?
  • CSS class name of preview window. You can customize the look of the preview window. For example, I’m using “tlpreview” as the class name and here is the code in my style.css:
    .prototip .tlpreview {
    width: 305px;
    background: transparent url(images/preview_top.gif) no-repeat left top;
    overflow: hidden;
    color: #FFFFFF;
    text-align: left;
    }
    .prototip .tlpreview .content {
    background: transparent url(images/preview_bottom.gif) no-repeat left bottom;
    color: #666666;
    padding: 0pt 12px 5px 6px;
    text-align: left;
    }
  • Show post title in preview window. Many people just use “previous post/next post” as the navigation link text and this option is especially for them.

The excerpt

If you wrote an explicit excerpt for the post, the explicit excerpt is shown. If the post doesn’t have an explicit excerpt, an excerpt is faked by truncating the whole post.

It’s using the same mechanism as “the_excerpt” tag. Same filters are applied to generate safe content for rendering in browsers.

If the post is password protected, no preview will generated for it.

Credits

I used the following script libraries for this plugin:

They’re really cool.

ChangeLog

  • 2008-03-14 (1.1.0): Added option: Show post title in preview window.
  • 2008-02-02 (1.0.2): Fixed a bug: variable $post was written as “post” without the dollar character.
  • 2008-01-14 (1.0.1): Used get_previous_post/get_next_post functions for compatibility.

16 thoughts on “WordPress Neighbor Post Preview”

  1. Great plugin! Thanks very much.

    I’m working on a theme now and I want to be able to show the excerpt for the next and previous post, not as a popup, but in the post. Do you know of an easy way to do this? Can your plugin be modified to do this? Any help would be greatly appreciated.

    Thanks!

  2. It doesn’t work with opera browser…
    That’s a pity cause is cool plugin! And i don’t change opera for nothin!
    Good work!

  3. Great plugin! Adds extra functionality without being obnoxious. Worked perfectly first try with WordPress v2.3.3.

    Thanks.

  4. Well, I found an issue, at least with my site. With the plugin activated and working properly, single page loads are very slow; delayed by 5-20 seconds every time. Also, when I click to go to a previous (or next) post, the background color of the page goes to black before my theme’s style sheet over-rides that and adds my correct color. I deactivated the plugin and haven’t had an issue since.

  5. @RioSif Thank you for telling me this issue :) I’ll try to solve the problem when I’m not so busy.

    @Aaron Did you feel my single post page delay? I don’t know why it’s causing your page delay. I monitored the page load with Firebug but found no performance issue.

  6. hmmmm now that i’m rechecking i see that it works… don’t know what happend… but i’ll use it to my blog too.
    Thank u!
    Great plugin!

  7. Really great plugin, each of my posts uses thumbnails in the excerpt and I’d love to be able to use these images for post navigation, I hope you’ll implement an inline version instead of the popup.

  8. This is just what I was looking for :-)
    I’ve modified it a bit, so instead of showing the next-previous links and the popup excerpt it shows directly the content of the excerpt, in my case I needed to display small thumbnails directly underneath the post.

    Great job, thank you.

  9. Hi,
    this is a great & useful piece of WP Code –
    Having seen the adaptations you made for futurosity, I was wondering if there was a way to have the previous_post_excerpt & next_post_excerpt link to the post as well. This should make some fotobloggaz happy.
    I checked the function code but could’t make the right changes to achieve the desired effect. Any help or pointers greatly appreaciated!

    Tx again for this work – you seem to be the only one to adress the deficiencies in how WP handles excerpts in such an elegant way.

    Cheers,
    Pete

Leave a Reply

Your email address will not be published. Required fields are marked *


− five = 1

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>