Support » Themes and Templates » Excerpt Link

  • Hi Guys,

    I have created a child theme based on the twentyten theme. It all works great however something strange is happening.

    The homepage displays a list of post excerts which is great. All of the links work great too.

    When i hover over the Post Title, the link displays correctly. When i hover over the ‘Read More’ link there seems to be an extra #more-‘ after the link. I have looked through all of the template files but am really struggling to see what is going on.

    When clicked it works fine but why is the read more link displaying this additional bit of code at the end of the link to the full post when i hover my mouse over it?

    Any help is hugely appreciated as ever guys.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • By default WordPress will add the ‘#more-‘ after your posts permalinks. It enables people to skip to the rest of the article if they have read the excerpt.

    To remove that, you need to add the following to your functions.php

    function removeReadMoreHash($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', 'removeReadMoreHash');

    That should do the trick.

    Hi Colin,

    Thanks for your help with this. Hugely appreciated. Doesnt seem to have any effect though. Here’s the child theme functions.php file …

    [538 lines of code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    Its near the top of the file. Sorry, i forgot to say.

    I noticed that you have two functions declared to remove the read more hash, maybe try deleting the second one.

    It’s likely that there’s some conflict with another function.

    Let me know whether removing the duplicate function works for you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Excerpt Link’ is closed to new replies.