WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How can I get page to load at the very top, rather then show content below 'more (4 posts)

  1. Firstthingjoe
    Member
    Posted 8 months ago #

    When a visitor clicks on the continue reading (more) on my front page they are directed to the part of the page where the content of the article they have not read appears at the top.

    Eyesopenreport.com

    I would like the visitor to open the page at the very top so my header and ad's can show right away.

    How can I make this happen?

  2. Josh (WP Edit)
    Volunteer Moderator
    Posted 8 months ago #

    Yup! Add this code to your custom functions:

    function my_more_jump_to_top($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', 'my_more_jump_to_top');
  3. Firstthingjoe
    Member
    Posted 8 months ago #

    Thanks Josh! That did the trick.

  4. Josh (WP Edit)
    Volunteer Moderator
    Posted 8 months ago #

    My pleasure :)

Reply

You must log in to post.

About this Topic