WordPress.org

Forums

Disable 'more' auto-scrolling (2 posts)

  1. Vragensteller
    Member
    Posted 2 years ago #

    Whenever I use the 'more' tag, I get "/#more-xxx" after the link that when the more button is pressed on the frontpage of the website. This little piece of the URL uses an auto-scrolling technique to make the location of the more tag the top part of the users screen, and I find this to be very annoying. Is there a way to turn this off? When users press the 'more' button, they need to get the exact same URL as when the title is clicked, so without the "/#more-xxx" at the end of the URL and without the auto-scrolling.

    Thanks in advance!

  2. Add this to your themes (or preferably your child themes) functions.php file:

    function remove_more_jump_link($link) {
    $offset = strpos($link, '#more-');
    if ($offset) {
    $end = strpos($link, '"',$offset);
    }
    if ($end) {
    $link = substr_replace($link, '', $offset, $end-$offset);
    }
    return $link;
    }
    add_filter('the_content_more_link', 'remove_more_jump_link');

    That will make the more button link to the top of the page.

Topic Closed

This topic has been closed to new replies.

About this Topic