Support » Fixing WordPress » How to add a “Read more…” tag to the_excerpt?

  • I am handcrafting excerpts for all my posts and want to add a “Read more…” tag right after the excerpt on the index page.

    I can’t find a solution on how to do this. Tried the “the-excerpt-reloaded.php” plug-in but that doesn’t help me either. Do I need to change the functions.php? If yes, how would I go about that? Thanks for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    You need to edit the index.php file of your theme and replace the_content with the_excerpt

    Thanks,

    Shane G.

    I’ve done that already – but how do I get the “Read more…” added to it without a line break?

    I did this in the functions.php file in my theme to remove the markup and the […]

    <?php
    function change_excerpt($content) {
    	$content = str_replace('[...]','...',$content); // remove [...], replace with ...
    	$content = strip_tags($content); // remove HTML
    	return $content;
    }
    add_filter('the_excerpt','change_excerpt');
    ?>

    Then I put this in place of the_content(‘Read more’); in my theme:

    <p><?php the_excerpt(); ?>
    <a href="<?php the_permalink() ?>">Read more</a></p>

    Works for me!

    Perfect! Many thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to add a “Read more…” tag to the_excerpt?’ is closed to new replies.