Friday, 26 January 2007



How can I create expandable post summaries?

With this trick, you can choose to display an arbitrary amount of text from the beginning of each post, as a teaser for the whole thing. Then users who want to read the rest of the post can click a link to see the full text. This is handy if you have lots of long articles all on one page. Note that you'll need to have post pages enabled in order to make this feature work.

There are three ingredients that go into this feature: conditional CSS, a "read more" link for each post, and a modification for the posts that use this feature. So let's go through it step by step.

Conditional CSS

We're going to use conditional tags to change how posts display on different pages. Add the following code to your style sheet, depending on what kind of template you have:

(for classic templates)

span.fullpost {display:none;}

span.fullpost {display:inline;}

(for layouts)

span.fullpost {display:inline;}

span.fullpost {display:none;}
Your style sheet is usually near the top of yo

No comments: