Viewing 6 replies - 1 through 6 (of 6 total)
  • Hey leahzero, sorry you’re having problems.

    Yes, it looks like the source of the issue is your use of Custom-MoreLink to remove the “#more-[post-id]” (represented by %anchor% in the Custom-MoreLink plugin).

    The “Read More Right Here” plugin relies on that value to know the post-id to use when requesting the rest of the content.

    I have an idea or two or fixing it and will post here when I’ve done so.

    Good news and bad news:

    Good News:

    I have a version of the “Read More Right Here” plugin that now works without relying on the URL of the more link. Which means that if there’s no “#more-[id]” part of the URL, the plugin will still work.

    It works by adding a custom class to the more link using the WordPress ‘the_content_more_link’ filter.

    Bad News:

    The “Custom-MoreLink” plugin modifies the entire content of the post to change the more link. It should (more ideally) be modifying only the link itself. More technically, it added a ‘content’ action hook instead of a ‘the_content_more_link’ filter.

    For whatever reason, my ‘the_content_more_link’ filter overrides these plugins.

    I checked two other plugins (https://www.ads-software.com/extend/plugins/more-link-modifier/ and https://www.ads-software.com/extend/plugins/custom-more-link-complete/), and they too are modifying the entire post content.

    I will be updating my plugin sometime soon (will post back here) with this update, but I’m afraid it won’t end-up being the solution you need. Honestly I would recommend contacting the authors of any of those other plugins and asking if they would consider modifying the more link using the actual filter provided by WP for that link (as opposed to filtering all the content).

    In the meantime, if all you need to do is remove the “#more-[id]” section of the URL, the following code will do it when added to any plugin:

    function temp_solution_morelink_removemore($link)
    {
      return preg_replace("(#more-(\d+))","",$link);
    }
    
    add_filter('the_content_more_link', temp_solution_morelink_removemore);

    Oh yeah, you could just add the above code to the ‘function.php’ file of your plugin.

    argggg….sorry, should read:

    “Oh yeah, you could just add the above code to the ‘functions.php’ file of your theme.”

    Thread Starter leahzero

    (@leahzero)

    Wooliet, thank you for your reply and for investigating the conflict between more-link-modifying plugins and Read More Right Here.

    Greatly appreciated!

    I’m trying to understand how your code example will work. If I add this to the functions.php file of my theme, will I be able to use RMRH with one of the plugins mentioned in this thread? Or should I hold off till RMRH is updated?

    Thanks again.

    Hi leahzero,

    No, the example code above will not make the “more link modifier” plugins compatible with ‘read more right here’. It will only remove the “#more-[postId]” section of your content link (which, if I remember right, was the only difference between your links and the default WP links).

    I don’t think it will ever be compatible with the other plugins (at least the ones I found).

    I looked at their code again and realized that the problem isn’t restricted to their modifying the link using the ‘the_content’ filter instead of the ‘the_content_more_link’ filter. The real heart of the matter is that they all simple replace text instead of inserting new text in the string. (I realize the text below is more than you’re probably interested in, but I’m just adding it as future reference for whomever stumbles across this thread)

    ———————————————————-
    So as an example, here’s what’s happening:

    WP gets the entirety of the post content and checks to see if a ‘more link’ is required. If so, it constructs that link and passes it through the ‘the_content_more_link’ filter.

    If no filters are there, the result is the default WP version, which might look something like this:

    <a href="https://yoursite.comz/2010/02/15/hello-world/#more-1" class="more-link">(more...)</a>

    The next version of ‘read more right here’ adds a filter, and inserts a custom class to the link. So what you’ll get is this:

    <a href="https://yoursite.comz/2010/02/15/hello-world/#more-1" class="rmrh-postId-1 more-link">(more...)</a>

    (notice ‘rmrh-postId-1’ in front of the ‘more-link’)

    WP then takes the post content, which now has the ‘more link’, and passes it through the ‘the_content’ filter. This is where the other plugins take that content and replace the above link with whatever has been set as the replacement.

    While the “#more-1” section of the link is removed (like you might want), the ‘rmrh-postId-1’ class is also removed. It doesn’t matter what might be there, the entire ‘class=xxxxxx’ section is going to be replaced with either the default or something you provided.

    This would potentially be incompatible with any other plugin that worked on the ‘more-link’.

    ———————————————————-

    Again, the code I wrote above is to simple remove the ‘#more-[post-id]’ part of the link. When I get RMRH updated, you should be able to

    1. deactivate the other plugin
    2. activate ‘read more right here’
    3. paste that code into your theme’s ‘functions.php’ file

    Hopefully you’ll notice an update to RMRH sometime in the next day or two. After that happens, try the above and let me know what happens.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Read More Right Here broken in 2.9.2?’ is closed to new replies.