Automatically transform your 'more' links into "view right here" links that immediately display the rest of your entry.
Both client-side and server-side code underwent a major refactor.
The following persistent options were added using the WordPress Settings API
Also added are client-side "events" using jQuery's trigger method. Other scripts loaded to the page can hook into these events to offer additional functionality.
Sample code for handling these events can be found in the FAQ section.
The follow two issues were addressed with this update.
The 'rmrh-show-more' class is now added to the 'read more' anchor element. When click, and new post content is pulled, that class is replaced by 'rmrh-show-less'. So with each click, the 'rmrh-show-more' and 'rmrh-show-less' classes toggle. This means that a CSS selector like 'a.rmrh-show-more' and 'a.rmrh-show-less' can be used to style the links.
The issue above relates to a situation in which new posts are added dyanmically to the page, and therefore the RMRM plugin is not executed against that new content. In this specific case, the user has the Infinite Scroll plugin activated. This plugin allows you to specify a callback function to execute after new posts have been added to the page.
RMRH was updated to expose the function '$.fn.ReadMoreRightHere'. If called directly, RMRH will execute against the entire document (ignoring any 'read more' links it's already seen). If any argument is passed, it will be treated as the context in which RMRH will execute. For the Infinite Scroll example, this will work:
So too will this:
The second version will restrict the RMRH plugin to searching for 'more links' to only the new posts added by Infinite Scroll.
Certain code paths called an as-of-yet undefined function. Function now defined earlier. Thanks to Boutros for reporting the issue and helping to debug.
Previous version using jQuery function not yet available with latest WordPress release.
Previous version inadvertently left non-default values.
This update is to address the following two issues:
Previously, RMRH was determining the 'more' links based on WordPress's default class for those links. The post ID was determined using the anchor's named element (e.g. #more-388 where 388 is the post ID). That information is now obtained using a custom class inserted into the link with the WP 'the_content_more_link' filter. This means that other plugins, which modify the final 'more' link format, will not interfere with this plugin.
However, a few of the plugins I found that allow you to modify the 'more' links output do not use the WP 'the_content_more_link' filter. They instead modify the entire contents of the post. The 'the_content_more_link' filter runs while WP is formatting the content, and then that content is passed through all registerd filters. The 'more link' modifying plugins I have looked overwrite entire sections of the link (as opposed to inserting new text when appropriate). So it is almost certainly likely that if you are using one of the 'more link' modifying plugins, it will not be compatible with this one.
The current version of this plugin remains free from leaving any remains of itself behind if uninstalled. However it is likely that future version will being to include a proper options page in the admin section of WordPress. This release is a step in that direction in that new features are available, but only by modifying variable values directly in the plugin. Please Note: Any changes you make to the plugin directly will be overwritten by an update to that plugin.
Each of these options are available within the wt_rmrh_oninit function of the read-more-right-here.php file.
Change 'more link' text when content displayed: You can enter new text that will be displayed as the 'more link' after the user. The original text will be returned when the user clicks the link again (collapsing the content)
Duplicate the 'more link' to the end of the post when the post is expanded. If the duplicate link is clicked, the browser will first scroll to the position of the original link, and then collapse the content.
Change the content expand/collapse animation speed
Internet Explorer 7 and up will not display the 'object' element (e.g. embedded flash content) when its dynamically inserted. If that is the browser in use, and if an 'object' element is found in the new content, the page will immediately redirect to the single post display (instead of expanding to show the new content).
The expand/collapse animation with 'object' elements looked pretty bad. Now, they are not shown until AFTER text has expanded. When collapsing, they are hidden BEFORE the text begins to move.
Using the proper 'is_admin' WP function to keep plugin out of the admin area. This was previously done with a PHP 5 only string comparison function against the URL. If the server was still using PHP 4, this function would break things.
Method used to obtain plugin's root directory no longer worked with 2.8.1 update. It has been changed to use the new:
This change means that the minimum version of WP now required is 2.8.
For those interested (and because I have no idea why this broke), the change in code was essentially creating the new content with this:
instead of this:
$j("<p> + newContent + </p>");
Plugin would not function correctly with installations in which WP is used as the root of the domain but the actual WP installed files are within a subdirectory of the root (see codex Giving WordPress Its Own Directory). This has been fixed (thanks to Thijs for the heads-up and solution).
Part of the fix means that the full plugin path used to get the animated "loading" image is retrieved as an AJAX call. If the user clicks a "read more" link before that call has completed, there will be no GIF associated with that link (but the content will still be pulled and expanded for the user).