I want to add read more to a blog. For that I need to replace the function the_content(). I found it in the loop file and replaced it with the_excerpt() but still posts are being shown of full length. Please help out.

EDIT: Here is the site. The read more is added now(I replaced all the occurences of the_content with the_excerpt). It gave rise to a new problem. All the links on the page are not working correctly. Please have a look.

1 Answer 1


Are you sure you have replaced it in the correct template file?

I found a useful way to tell by adding this to the functions.php file:

    add_action( 'wp_head', 'adminbar_print_template' );
function adminbar_print_template() {
    global $template, $current_user, $wp_admin_bar;

        /* If you have more than one user deny. Be sure to use your user ID! */
    if ( !is_user_logged_in() && $current_user->ID != '1' )
    if ( is_admin_bar_showing() )
        $wp_admin_bar->add_menu( array(
            'parent' => false,
            'id' => 'template',
            'title' => $template,
            'href' => '#'
        print_r( $template );

If you have the Show Admin Bar settings set to "show when viewing site", it will output the current template file being used on the page you are viewing. Another possibility could be that your theme uses a loop.php file, and you will need to modify it for the excerpt.

TIP: Add this to your functions.php file so the "Read More" tags are actually links to the posts:

   function new_excerpt_more($more) {
   global $post;
   return '… <a href="'. get_permalink($post->ID) . '">' . 'Read More &raquo;' . '</a>';
   add_filter('excerpt_more', 'new_excerpt_more');
  • I tried the way wordpress.org suggested. Now I am stuck with a weird problem, the posts do have read more option but ALL the links on the blog are not working correctly. can you help out? Have a look pricelessproject.com/wordpress
    – user2238
    Aug 7, 2011 at 2:29
  • I viewed your site and they seemed to work correctly. What page/links specifically are you having problems with? Aug 7, 2011 at 2:33
  • Its pricelessproject.com/wordpress . I tried again but NONE of the links are working correctly. I am being redirected to the homepage.For example, click read more on any of the post and you will be redirected to the homepage. Same problem with all the links
    – user2238
    Aug 7, 2011 at 2:35
  • I see now. Have you checked to make sure you removed all the old read more code? You need to remove what you had and replace it with what I've posted. In your template files, you need to put <?php the_excerpt(); ?> Aug 7, 2011 at 4:52

Your Answer

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