How to Use Wordpress 2.3x Tags and the “More” Function with Excerpts
By LC on Dec 30, 2007 in Building LocalCenters.com
1. Activating the “Excerpts” function:
Your code looks something like this, now:
<div class=”entry”>
<?php the_content(’Read the full article’); ?>
<?php if ( function_exists(’the_tags’) ) : ?>
<div class=”tags”><?php the_tags(); ?></div>
<?php endif; ?>
</div>
To add the excerpt function, change it to this:
<div class=”entry”>
<?php
if ($single) {
the_content();
}
else {
the_excerpt();
}
?>
This change gives you the option of writing an excerpt, or by default Wordpress will take your first 120 (?) words and use it as an excerpt. The single page contains your full post and with this code your excerpt will not be repeated there.
2. If you use Wordpress 2.3x tags, they will appear in the excerpt which only adds to visual noise. Here’s how to add Tags” to the above code and still constrain them to your single page post.
<div class=”entry”>
<?php
if ($single) {
the_content();
}
else {
the_excerpt();
}
?>
<?php if (is_single()) if ( function_exists(’the_tags’) ) : ?>
<div class=”tags”><?php the_tags(); ?></div>
<?php endif; ?>
</div>
Now, your tags will appear only at the end of your single page only, just above the comments!
3. Using the “More” Function
I am a good example of so not a geek, and as such I am sure many join me in not intuitively understanding this:
[….] which Wordpress generates is you do not write your own excerpt. If you do write your excerpt, there is no directive to read on after the excerpt ends.
The traditional “More” function is disabled with excerpts. Although the Wordpress Codex gives a way of calling up a “more” directive with php, I like the manual method better. It’s totally custom and very easy.
First, you will have to publish your post to get the correct URL Permalink. At that point Wordpress will generate a […] at the end of the auto-generated excerpt. If you want to write your own OR hyperlink to the full post, go back to “manage posts” and simply use the
<a href=”your post PermalinkURL”> and-say-anything-you-like-here</a> and drop this in just after your excerpt string. I’ve used “find out how!” “read on” and “more” depending upon the nature of the post.
Good luck, hope this helps some that have shared my frustrations



On Dec 30, 2007, Rolf said:
Very interesting and solves the irritation that I could not. I now have a different reference of a shopping centre builder.
On Jan 7, 2008, music said:
very interesting.
i’m adding in RSS Reader