Forums

Like Gawker and Gizmodo: How to Format Individual Blog Posts Within the Loop (3 posts)

  1. jtrotter
    Member
    Posted 2 years ago #

    What would be the best way to have different "templates" for posts appearing in a loop? I have a pretty good grasp of CSS, WordPress, and how the two interact—but all I'm finding it advice on how to modify CSS per page, not per post within the loop

    A really good example is how Gawker or Gizmodo can individually format their posts.

    Here's what I'm talking about:

    http://gawker.com/5107416/new-post-types-on-gawker-sites

    How can I do this well? Not instructions, but good strategy. Thanks!

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    How about first deciding how many different displays you want (eg. 4 called style1, style2 etc). Then doing floor(post id/4) to obtain an integer which you can then add onto to "style" to produce class="style3 etc which can be added to the <body> tag or similar dynamically? That would give you a random style.

    If you want to apply styles on a pre-catgeory basis, you could use in_category() to apply the appropriate class. In theory, you could do something similar based on tags. Or post date. It really depends how/when you want to apply the different styles.

  3. casanovaruffin
    Member
    Posted 2 years ago #

    I'd like to know how to do this. Is there any way to do this using custom fields?

Topic Closed

This topic has been closed to new replies.

About this Topic