WordPress.org

Support

Support » How-To and Troubleshooting » Disable 'more' auto-scrolling

Disable 'more' auto-scrolling

  • Vragensteller
    Member

    @vragensteller

    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!

Viewing 1 replies (of 1 total)
  • Josh
    Participant

    @josh401

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘Disable 'more' auto-scrolling’ is closed to new replies.