Tutorial: Conditional Leafs in WordPress Headway (part 2)
I woke up this morning and realised I’d not fully explained myself in yesterday’s tutorial about conditional leafs.
What it lacked was an example of conditional leafs – I only showed you conditional headers.
So, let’s say you have a leaf you want to only appear on the single posts. For example, you might want to display a disclaimer, or related posts etc.
In the Visual Editor, create the leaf as required and let’s say you’ve given it a custom class name (a good habit to get into) of “posts-footer”.
Then the custom CSS would simply be:
body.content div.posts-footer {display:none;}
body.content.single div.posts.footer (display:block;}
Too easy, eh?
By the way, this would be a TextHTML/PHP leaf with the appropriate code.
There are other ways of course…
1) Some plugins give a shortcode for related posts, but I’m not a fan of short codes because they just complicate things for the end user.
2) You could also use Headway’s Easy Hooks, but then you’d have to do more work to style it.
3) And of course, you could simply define a unique page layout for single post pages. The disadvantage of that is you then have to replicate all the leafs and setup custom classes as required. Again, I think it’s more work.
The one minor downside of these leafs that are only shown on certain conditions is that in the Visual Editor, your page will only look right for single posts, so you’d have to remember to check layouts on others pages – which I’m sure you do anyway…
As always, it’s really about problem solving and pushing the boundaries. Headway is a brilliant theme framework for standard WordPress websites, and as such, it’s easy to overlook its ability to create clever and complex designs.
So get experimenting and let us know what tricks you discover!
Related posts:
-
Matthias
-
Chris
-
http://www.mactonweb.com Web design London
-
http://www.webhostings.in/ web hosting

