Our First Project: Expanding/collapsing WordPress posts
OK, this is a quick project, but it requires that we use a little bit of everything we just covered. I've always liked that WordPress had the <!--more->
feature to make posts "condensable" for the main post view page, but that doesn't always suit my purposes for some types of posts. Let's assume that my blog will have relatively short posts, yet I really want a reader to be able to see as many headlines as possible, above the fold, without having to scroll or scan any content (we'll suspend reality and pretend that my post headers are just unbelievably interesting and compelling).
I'd like the user to have the option to expand the post that interests him, while keeping him in the context of all the other post headlines. You've probably seen similar enhancements to this on many sites. This is a very popular jQuery enhancement for FAQ and press release posts.
Let's take a look at how we'd do that. Set up a clean custom-jquery.js...