0

I'm using WP version 4.4.4. I have some posts where it has a continue reading button and link to the actual excerpt. My problem is the excerpt also has a continue reading button. Here is my code at the end of functions.php.

function new_excerpt_more($more) {
global $post;
return '... <a class="moretag" href="'. get_permalink($post->ID). '"> continue reading &raquo;</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');

Fairly new to WordPress. I searched this site but nothing worked for me. Thanks.

0

Your question is not entirely clear, but it looks like you simply want to remove the continue reading button from the excerpt. You have already found the offending code. Nothing stops you from modifying it in this way:

function new_excerpt_more($more) {
global $post;
return '';
}
add_filter('excerpt_more', 'new_excerpt_more');

To do this properly you must not change the theme file itself, but place this code in the functions.php of a child theme, which further only needs to consist of an almost empty style.css file. If a function in a child theme has the same name as in the parent theme it will override the latter.

| improve this answer | |
  • This doesn't work. I have a blog page where all my posts are being displayed. Posts which have long content (words more than 99(?)) are being cut off and has a continue reading link. Upon clicking the continue reading link, I will now be redirected to the actual post. Problem is there is also continue reading link in that page and I can't read the whole post. – Hiei Aug 31 '16 at 13:08
  • This sounds like something different from your original question. Either the link of the archive page is not to the single post or the template that should produce the single post doesn't do it. – cjbj Aug 31 '16 at 13:17
  • The link is working fine. I'm being redirected to the post, but there still is the continue reading link.. – Hiei Aug 31 '16 at 13:21
  • So that means the template (normally single.php) doesn't ignore the more tag, as it should. – cjbj Aug 31 '16 at 13:26
  • Okay. So in my content.php, when I changed the_excerpt(); to the_content the continue reading link is now gone. But in the blog page where the continue reading should appear is now also gone. – Hiei Aug 31 '16 at 13:59
0

[ added answer to enable closure of the question]

After discussion in comments under the other answer the problem seems to be not with the filter, but with a missing template for single posts/pages.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.