Support » Themes and Templates » [Resolved] Display different post style [css] in each category

[Resolved] Display different post style [css] in each category

  • Hello,
    I want to display different post style [css] in each category.

    is it possible..?

    Thank you.

Viewing 15 replies - 1 through 15 (of 16 total)
  • Michael


    Forum Moderator

    check if your theme uses body_class() and/or post_class() which should give you category specific CSS classes;


    Ok, I use body class… It’s my custome theme ..

    How cna i modify posts with that.. :S ..and can you tell me why I don’t see featured images on my posts :S ..



    Forum Moderator

    my mistake – you will actually need to use post_class() so you can style the posts according to their category.

    see http://codex.wordpress.org/Function_Reference/post_class for the CSS classes that generated.

    why I don’t see featured images on my posts

    are you using the corresponding function the_post_thumbnail() in the single.php template?

    with a custom theme, nobody but yourself will have access to the code, so any help through this forum will be very limited.

    I fix thumbnails but i still can’t do that with different css style on categories… 🙁

    link : http://stefanvblog.com/category/news/

    can you explain me… I’ve been trying all day



    Forum Moderator

    you seem to have succeeded in getting the background image to change for the different category archives.

    as for the individual posts, the CSS classes by post_class()) are for example in this line:
    <h2 id="post-570" class="post-570 post type-post status-publish format-standard hentry category-news tag-kitkat">

    what are you trying to format differently?

    to target the individual posts according to their category, try for example:
    .hentry.category-news { background: red; }

    I want my interview category be like this one on picture


    Thank you for answer. 🙂

    Yes! i did it with you help! Thank you very much! :))

    can I change that thumbnail image with css too ?

    something like..

    .hentry.category-news.thumb { … }

    this don’t work.. do i need to add something els .. Thank you



    Forum Moderator

    the element with the CS class .thumb is a different element from the one with the ‘post_class()’, therefore try:

    .hentry.category-news .thumb { ... }

    Thank you… Awesomee! 😀

    I know this is not my question, but when you’re already so good at this I must ask You just this.

    Do you know how to remove the text below title and that remain only Title and Thumbnail.

    on this link : http://stefanvblog.com/category/interview/

    Thank you for all 🙂 You made my day 😀



    Forum Moderator

    the text will be from the code the_content() or the_excerpt() within your category.php or archive.php or index.php template; http://codex.wordpress.org/Template_Hierarchy

    I know.. it is from the_excerpt(), but when i delete that text disappear in all categories.. and I only need to disappear in categori-interview.



    Forum Moderator

    try to change from:
    <?php the_excerpt(); ?>
    <?php if( !in_category( 'interview' ) ) the_excerpt(); ?>

    That’s great.. Thank you!

    Can i have custom size of this thumbnail on this link..
    I create frame fot thumbnail..

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Resolved] Display different post style [css] in each category’ is closed to new replies.
Skip to toolbar