Okay
  Public Ticket #728464
Read More Button
Closed

Comments

  • Kathy started the conversation

    Hi,

    You can tell if it's possible on this page of posts...if the "read more" button can go to the blog post page AND NOT default in the middle of the page, but at the top of the page (and just load like normal--I need the <a href link to NOT have "/#more-14190"  at the end of each link.

    Thanks!

  •  895
    TheFox replied

    Hello Kathy

    Prevent Page Scroll When Clicking the More Link

    By default, clicking the .more-link anchor opens the web document and scrolls the page to section of the document containing the named anchor (#more-000). This section is where writers choose to place the <!--more--> tag within a post type.

    Users can prevent the scroll by filtering the content more link with a simple regular expression.

    function remove_more_link_scroll( $link ) {
    	$link = preg_replace( '|#more-[0-9]+|', '', $link );
    	return $link;
    }
    add_filter( 'the_content_more_link', 'remove_more_link_scroll' );
    

    Simply add the above code to the theme's functions.php file and the named anchors are no more

    Do not hesitate to contact us if you have more questions.

    Have a nice weekend!

    Regards.