Using WordPress’ the_excerpt function, or that box that says ‘Excerpt’ creatively isn’t something that too many people do. Why not? Not sure. But maybe that will change – the_excerpt can do so much so easily.
Display a quote from an article
Something that I used to do on Nometet was have a blog-like layout with a quote from the article displayed below the title. It’s something that gives the reader a quick peek at what’s in store in the article and well, looks pretty cool! What’s more, it’s easy to do – just pop a quote into the excerpt box when you’re writing a post. To implement your exciting new quote, just pop <?php the_excerpt(); /> into your theme’s files.
Display a random quote in your header/sidebar/footer
Now that we’re displaying random posts on our homepage (as shown above), next thing we can do the_excerpt is show a random quote on our header/sidebar/footer. Assuming you’ve filled out the Excerpt field for all your posts, the following code will display a random quote, with a link to the article:
[php]<?php query_posts(array(‘orderby’ => ‘rand’, ‘showposts’ => 1));
if (have_posts()) : while (have_posts()) : the_post();
[…] them!), just a couple of things to know. The text pulled on the front page – that’s the excerpt. The image used can be put in place as with Biblioteca, as the screencast shows (link if you […]
Does the tip "Display a random quote in your header/sidebar/footer" not create non valid code? the_excerpt outputs p tags, which is a block-level element, and as far as I understood it, that can't go inside an inline element, ie the link.
The same goes for avoiding custom fields, except here doesn't that also mean the scr attribute has p tags in it?
You could well have a point there. Looks like we’re all stuck with custom fields for a while!
oh yeah … cool trick to pass html validation .. that rocks, thx a lot
using the_excerpt_rss() is working I mean …