I would like to show the category name with the color they belonged to in the top of the every images in the recent news widget.
For Ex : http://www.awesomescreenshot.com/image/385936/756ddd9f3fe5cc3a8d50aedc71cc3fa0
Hi,
To resolve this issue, you can do as the following:
-
Open the wp-contentthemesdw-focusincwidgetsdw-focus-recent-posts.php file. Add the following code under line 166:
<?php if( isset( $instance['cat'] ) && $instance['cat'] ) { $categories_list = get_the_category_list( __( ', ', 'dw_focus' ) ); if ( $categories_list && dw_focus_categorized_blog() ) : ?> <span class="cat-links"> <?php printf( '%1$s', $categories_list ); ?> </span> <?php endif; } ?>
- Remove the line code from 206 to line 216.
- Add the following code to the style.css file:
.dw_focus_recents_posts.latest-news .entry-thumbnail {
position: relative;
}
.dw_focus_recents_posts.latest-news .cat-links {
background-color: #41962F;
position: absolute;
padding: 2px 7px;
top: 0;
margin: 10px;
}
.dw_focus_recents_posts.latest-news .cat-links a {
color: #fff;
font-weight: bold;
}
Hope this helps !
Hi Dominic Code look what i am exactly looking for , I had update the change you provide here , but it seems like not gets works for me .
Changes which added for recent-post.php file : https://github.com/karthick-m-ica/focus/blob/master/dw-focus-recent-posts.php
Fixed, Works great , Thanks . Is it possible to get the category color as background ?
Unfortunately, you can not get the category color as the image.
Is there any possible to customize get the text background color as its category color ?
And i had check the output through inspect : If there is a multiple category selected for a post it is not as separated as
- format .
At the moment, our theme do not support to make background color for each categories as what you want. However, if you want to have it, we are ready to help you as a custom work with a charge of fee is $50.
In case that you are still interested in the feature, please kindly let us know, we will check and estimate the time.
Regards,
Thanks Dominic will check and let you know if the changes required .
Please login or Register to submit your answer