Viewing: One Entry

RMRH Update for WP 2.8.1

July 16, 2009 @ 22:28:34

I had to update the Read More Right Here plugin for the recent 2.8.1 Wordpress release (details below). The most important item to note is that now the minimum required version of WP is 2.8.

Details, Details

I previously was calling a function I wrote to set the URL to the plugin root directory. This was then used to register the script with WP and was also passed down to the javascript using wp_localize_script.

The one-liner function:

function wt_rmrh_getBasePath()
{
    return get_bloginfo('wpurl') . "/" . PLUGINDIR . "/" . plugin_basename("read-more-right-here/");
}

With the 2.8.1 update, the above no longer worked. Before 2.8.1, the path in a page’s header was (in part):

   plugins/read-more-right-here/js/wt_rmrh.js

After the 2.8.1 update, the path became:

   plugins/read-more-right-herejs/wt_rmrh.js

Needles to say, that javascript file isn’t going to load.

I looked through wp-includes/plugin.php and found the plugin_dir function which

Gets the URL directory path (with trailing slash) for the plugin __FILE__ passed in

(their function comment).

So I deleted the function (which was only being called once) and replaced

$pluginUrl = wt_rmrh_getBasePath();

with

$pluginUrl = plugin_dir_url(__FILE__);

Everything seems to be in working order now. At least until the next Wordpress version!

9 comments

July 17, 2009 @ 16:08:54

Well done,
I love the plugin.
I tried to alter it a bit so that it removes/hides the (more..) link.
(And unhides another so that it makes the link appear all the way down the post). But my Javascript skills aren’t that great.
I stopped fiddling after I discovered that things, like embed Youtube videos for example, are not shown in Internet Explorer. It just gives a broken-image link. Works fine in FireFox. Not sure if that’s a AJAX/jQuery or the Plugin problem.
So alas, I had to disable it for now. I will check for updates :)

September 13, 2009 @ 19:33:12

Have you seen the way the “fold” works at fivethirtyeight.com ? The moretext goes away and the “contract post” link jumps to the bottom of the article. It’s very good. Any idea how it’s done?

September 14, 2009 @ 09:46:59

I’d never seen that. I like the way the more text shifts to the bottom. One difference (as it’s not a WP blog) is that all of the content, for each of the posts, is already loaded. Clicking “more” just display what’s already there (but hidden). One of my goals was to not add an extra bandwidth cost but instead dynamically pull everything down only when the reader wants to see it.

But in terms of useability, I do like the more text moving to the bottom. Thanks for the pointer.

September 16, 2009 @ 09:19:26

What about just changing the text upon opening the content? Even without jumping to the bottom, I think it would still be great if you “Read more…” could become “Read less…”.

September 21, 2009 @ 16:56:30

On one of my sites my whole wordpress crashes when activating the plug-in (once deleted it’s all good again).

Bu would really like to use it. Iam running the latest WP install. Any ideas?

September 26, 2009 @ 06:51:13

@Kaymir

Sorry to hear that. I might be the same issue reported by james.jackson at this post. I’m using a PHP5 only function, so it might be that your server is using an older version of PHP. Here was what I suggested to him (until I get the time to update the plugin):

If you’re up to it, you can comment out the if statement with that function call (~ line 42). It’s only purpose is to keep the RMRH javascript from loading while in the admin area. There are better Wordpress functions I should be using instead (though it seems like I had issues with them when I originally wrote this). Anyway, you can comment that out and it won’t be a big deal.

October 20, 2009 @ 08:21:03

I love this plugin!

However, can you get the ‘Read More’ to become ‘Read Less’ and vica versa when it’s clicked to expand and contract?

It doesn’t look right still saying ‘Read More’ once the read of the post has been expanded.

November 2, 2009 @ 08:15:49

Seem work perfect, but I cant us it because there is a problem about Latin accentuated character’s display.

For example text with word like “été” in French is displayed like été if under the tag.

I hope this help to fix it.
Tanks for develop this interesting plug-in.

November 2, 2009 @ 16:21:57

I love this plugin! What I would like though, is to have the possibility to make it so that the posts are preloaded. I use this plugin for my portfolio which is based around alot of pictures. As it is now, the post opens up and show it’s content before the images have chance to load, showing alot of half or not loaded pictures at all.

Another cool feature would be if the images preloaded before the post expand itself. As it is now it don’t work properly

Many thanks for this great plugin. I will continue to use it, but there’s always room for improvement :)

Comments can be removed at any time for any reason. Thanks.