i'm working on a blog page.i'm trying to use excerpt() function to add "read more" tag to get to the full content page and the comment section. there is a div like this

<div class="post-excerpt">
        <?php the_excerpt(); ?>

and then i added the function we all know that should be there in functions.php

function new_excerprt_more($more){
    global $post;
    return '...<a class="moretag" href="'.get_permalink($post->ID). '">Continue reading</a>';

so far so good no problem till here. the problem is that when i click on "continue reading" tag it exactly shows me the excerpt(with continue reading tag) plus the comment section instead of showing full content(without continue reading tag) plus the comment section.

so it seems that "get_permalink($post->ID)" is not actually doing his job correctly and i have no idea why. besides i have a header in blog page that has a php code like this

<?php the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>'

and this one doesn't work either!(should do the same thing like continue reading". so does anybody know what the heck is going on!?

1 Answer 1


get_the_permalink() does not modify or do anything to the_excerpt(). That's now how viewing post content works. All it does is output the permalink the single post.

When you visit that link it will load a single post using the template it finds according to the template hierarchy. You need to make sure that the template that your theme uses for the single post uses the the_content() function, instead of the_excerpt().

  • thanks for the response. actually i know that the_content() should be replaced instead of the_excerpt in content-single.php file but in the theme directory i only have single.php . so i will try to create it manually and make changes accordingly. thanks
    – gm2870
    Commented Sep 5, 2018 at 11:58
  • content-single.php is irrelevant. The only templates that matter are the ones in the hierarchy I linked above. Some themes will break it down into smaller parts, like content-single.php, and include them with get_template_part(), but WordPress is still loading single.php, and what matters is that the_content() is used in single.php or a file that's included in single.php. Commented Sep 5, 2018 at 12:07
  • yes i understand what you said. i solved the problem with changing this line get_template_part('template-parts/content', get_post_type()); to get_template_part('content', 'single'); which shows everything inside content-single.php which i created manually and added the_content() to it.
    – gm2870
    Commented Sep 5, 2018 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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