We all know that the “more” tag in wordpress allows you to place a break in a post in a specified position. But what if you wanted to cycle featured posts on your wordpress blog and you didn’t want to add a “more” tag to every post (or have to go back and add a more tag to hundreds of old posts)? There are plugins available to do this but I tried a couple and didn’t have success. The easiest way I found to handle this situation is by using the_excerpt()
instead of using the_content()
.
By using the_excerpt()
, wordpress will automagically use the except text from your post or it will use the first 55 characters provided you don’t have any text in your excerpt. For someone like me who doesn’t like to use arbitrary “more” tags, this method is great. You can alter the number of characters displayed as well as make other customizations. The codex for the_excerpt()
can be found here.
I like using plugins to get thins done in Wordpress, but oftentimes some simple and straightforward coding is the simplest and fastest way to go.