three4one design

design is the face of your business

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:

  1. Tutorial: Easy Conditional CSS in WordPress Headway theme
  2. Screencast tutorial: Styling Multiple Leafs with Custom CSS Classes in WordPress Headway
  3. Tutorial: Coding a complex design using the WordPress Headway framework
  4. Headway tips: Using Custom Classes in Leafs
  5. Tutorial: Using Multiple Content Blocks plugin in Headway for WordPress
  • Matthias

    Thanks for this tutorial!

    I have a question that I’m confident you can answer me: How can I use this feature to style one of my leafs (on all pages) differently from the rest? I’d like to have one text leaf with a yellow background (all the others should be white) to be displayed on all of my pages.

    Any ideas?

    thanks in advance!!

    cheers Matt

  • Chris

    If you are using the same layout, then Linking would already cover that.

    However, if you have different layouts, then just ensure that the leafs you want yellow on each and every page have the same custom class name.

  • http://www.mactonweb.com Web design London

    Then just ensure that the leafs you want yellow on each and every page have the same custom class name.

    web Design london

  • http://www.webhostings.in/ web hosting

    Excellent written skills. I get it clear idea about your topic.Above all the points are explained very clearly.

blog comments powered by Disqus
© Copyright 2010, Chris Howard, three4one design
Site built using the Headway framework
Better Tag Cloud