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.
-
check if your theme uses
body_class()
and/orpost_class()
which should give you category specific CSS classes;http://codex.wordpress.org/Function_Reference/body_class
http://codex.wordpress.org/Function_Reference/post_classOk, I use body class… It’s my custome theme ..
http://stefanvblog.com/category/news/How cna i modify posts with that.. :S ..and can you tell me why I don’t see featured images on my posts :S ..
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
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; }
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
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 π
the text will be from the code
the_content()
orthe_excerpt()
within your category.php or archive.php or index.php template; http://codex.wordpress.org/Template_HierarchyI 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.
try to change from:
<?php the_excerpt(); ?>
to:
<?php if( !in_category( 'interview' ) ) the_excerpt(); ?>
http://codex.wordpress.org/Function_Reference/is_categoryThat’s great.. Thank you!
Can i have custom size of this thumbnail on this link..
http://stefanvblog.com/category/interview/
I create frame fot thumbnail..
- The topic ‘Display different post style [css] in each category’ is closed to new replies.