• Hi. My posts are short so I would prefer it if the ‘Continue reading’ links on my home page and archive pages didn’t jump to a point part-way through the post. I’d rather remove the ‘#more-01’ from the ‘Continue reading’ link, leaving just the regular permalink – so the user sees the whole post, from the top.

    I’m using a child theme to make my changes to Twenty Fourteen. But I can’t see what defines the link for ‘Continue reading’ in the original Twenty Fourteen files.

    Does anyone have any suggestions?

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • I found the answer here: [link moderated – the site’s url is in violation of https://wordpressfoundation.org/trademark-policy/ ]

    There is some code you will need to add to your functions.php file. I tried it and it works.

    I was looking for the same, I copied functions.php to the child theme and inserted the code directly after the ?php opening, but I get an error.
    Anton, were exactly did insert the code? Did you paste it in a empty functions.php or did you copied the original and inserted the code there?
    thanks for the help …

    Sorry, I should have looked better on the wordpress site, I found the info I needed here : https://codex.www.ads-software.com/Child_Themes and it works!
    Thanks a lot

    Thread Starter chrislondon

    (@chrislondon)

    Thanks for your answers. I still can’t get it to work though. When you add it to the child theme, do you start with this?
    if (function_exists('remove_more_tag_link_jump')) {

    Just paste below code in a new text document and save it as functions.php in your child theme folder.

    <?php
    
    function remove_more_tag_link_jump($link) {
        $offset = strpos($link, '#more-'); //Locate the jump portion of the link
        if ($offset) { //If we found the jump portion of the link
            $end = strpos($link, '"', $offset); //Locate the end of the jump portion
        }
        if ($end) { //If we found the end of the jump portion
            $link = substr_replace($link, '', $offset, $end-$offset); //Remove the jump portion
        }
        return $link; //Return the link without jump portion or just the normal link if we didn't find a jump portion
    }
    
    add_filter('the_content_more_link', 'remove_more_tag_link_jump'); //Add our function to the more link filter
    
    ?>

    As you can see in https://codex.www.ads-software.com/Child_Themes it needs to be only the code you like to add to the functions.php :

    Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)

    Thread Starter chrislondon

    (@chrislondon)

    Thanks a lot. It works now.

    I already had a couple of functions in the functions.php file in my child theme, so originally I tried pasting in the new code at the beginning of the document, after the opening <?php and before my other functions. For some reason that gave me a parsing error, but I’ve tried adding it at the end, before the closing tag, and that works.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove '#more-" jump from 'Continue reading' link’ is closed to new replies.