- This topic is empty.
-
AuthorPosts
-
December 21, 2014 at 10:41 am #191371crawlingParticipant
Hello,
I am trying to make the logo that i uploaded for category news to appear on all articles posted in that category .
Below you can see the logo for the category news
http://unitednews.sr/category/news/
Now this is a article posted in the category news but the logo does not show .
http://unitednews.sr/news/vijf-rredenen-waarom-venture-capital-niet-werkt/
In css i added this code for the logo to show on single articles that are part of that category.
body.category-1 #logo a { background: url(http://unitednews.sr/wp-content/uploads/2014/11/logo.png) no-repeat;
height: 26.5px;
width: 150px;
display: block;}body tag should make it work right ?
December 21, 2014 at 12:07 pm #191373SenffParticipantSorry, but we can’t check it since the site is in Maintenance Mode.
Having said that, the class “category-1” is only applied on pages that show posts in that category. By default, a single post in that category does not have that class in the body, o so you may have to add that functionality that a single post gets the class of every category it belongs to.
December 21, 2014 at 12:44 pm #191376crawlingParticipantForgot to disable maintenance mode , yes i did add this code in my functions.php
`function add_category_body_classes( $classes ) {if ( is_single() ) { global $post; $cats = get_the_category($post->ID); foreach( $cats as $cat ) { $classes[] = 'category-' . $cat->slug; } } return $classes;
}
add_filter( ‘body_class’, ‘add_category_body_classes’ );`December 21, 2014 at 2:05 pm #191380SenffParticipantThat code adds a class with the category slug, not the category id.
So, it’ll have
category-news
and notcategory-1
. Make sure you target that in the CSS:body.category-news #logo a { background: url(http://unitednews.sr/wp-content/uploads/2014/11/logo.png) no-repeat; height: 26.5px; width: 150px; display: block; }
Also noticed that there is HTML code (social icons) in the HEAD of your document, not in the BODY.
December 22, 2014 at 6:47 am #191429crawlingParticipantGot It !
Thank you for your help. -
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.