Reputation: 5251
I have the following piece of code which outputs a long article:
<?php the_content(); ?>
I am trying to show only an excerpt of the article (the first 29 words), strip out the HTML and add a "...more" at the end.
<?php substr(the_content, 29) ?>
I have tried this but it has no effect on the length.
Any help? Thanks
Upvotes: 1
Views: 152
Reputation: 160953
What you need is the_excerpt
<?php the_excerpt(); ?> //and you could check the doc how to set the length.
Upvotes: 2
Reputation: 10246
<?php echo substr(get_the_content(), 0, 29); ?>
the_content prints the content and get_the_content will get that.
Upvotes: 0