Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDean Yeong
10,053 PointsStrip Tags
I like to strip of the <p> tag so the 'continue reading' is in the same paragraph with the excerpt. Can someone please correct me? Thanks.
<div class="home-post-content">
<?php echo strip_tags( the_excerpt(); ); ?>
<a href="<?php the_permalink(); ?>">Continue Reading</a>
</div>
2 Answers
Zac Gordon
Treehouse Guest TeacherCheck out this article in the Codex on customizing the_excerpt. It's best done from the functions.php page (as mentioned by Dave). http://codex.wordpress.org/Customizing_the_Read_More
Dave Thomson
3,157 PointsStraight off I can see a syntax error on line 2 - the first semicolon would need removed;
The method I use to do this involves adding code to the functions.php file in your theme, this way the change is handled consistently across the theme and it keeps your files a little bit cleaner...
function new_excerpt_more( $more ) {
return ' <a href="'. get_permalink( get_the_ID() ) . '">Continue Reading</a>';
}
add_filter( 'excerpt_more', 'new_excerpt_more' );