jtrotter
Member
Posted 4 months 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!
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.