try and use post_class()
in the div of each single post on the front page.
http://codex.wordpress.org/Function_Reference/post_class
edit index.php (or whatever template displays the front page) and try to locate the beginning of the loop (http://codex.wordpress.org/The_Loop_in_Action)
locate the first <div
which might have some code such as id="post-<?php the_ID(); ?>"
and which might even already have the post_class in there;
if not, add it.
the post_class will add category-dependant css classes to the div, and you can use them to style your post.
Thanks for the swift answer!
Two questions though.
1. This is the beginning of the loop in my theme. Where would you include the post_class, 2nd or 3rd line?
[Code moderated as per the Forum Rules. Please use the pastebin]
2. How do I specify the post_class attribute to the category in terms of code? How would that specific tag look? And how would the classes in the stylesheet be called?
in this line:
<div class="post">
for instance change it to this:
<div <?php post_class('post'); ?>>
(this will always integrate the class=”post” into the post div, together with the automatically generated classes)
2.
example for a post with one category and two tags:
<div class="post-1 post type-post status-publish format-standard hentry category-contact tag-apples tag-bananas">
the word(s) after .category-
is the category slug;
for a category with the title ‘Going Home’ this could be .category-going-home
in your casse, with the <div id="posts">
surrounding the loop, typical styles in style.css would be, for example:
#posts .post.category-contact { ... }
#posts .post.category-contact h2 { ... }
#posts .post.category-contact p { ... }
to catch up with css:
http://www.w3schools.com/css/
Thank you so so much for that help!
One last question though. So, do I have to make a <div class=”…. for every kind of class of post that might pop up (in my case, four plus the uncategorized one)?
ah, I think I just got it. Your code-example after 2. is just what the Loop will produce later. I only need to integrate the first little line into my index.php and then fix up the stylesheet for things I want to be displayed differently, right? Thanks again!!
I only need to integrate the first little line into my index.php and then fix up the stylesheet
more an exchange than an integrate – but principally:
yes.