- This topic has 12 replies, 2 voices, and was last updated 5 years, 11 months ago by sg.
-
AuthorPosts
-
May 14, 2018 at 10:33 pm #575785sg
Hi Tom, i am trying to change the category color for the category labels under the article.
i did add individual css class but it seems its sharing the div. pls take a look at my site. thanks.
May 15, 2018 at 4:11 am #575971DavidStaffCustomer SupportHi there, have you resolved this issue? I can see each of your category links have a blue background.
May 15, 2018 at 5:02 am #576025sghi David,
no i am looking at coloring different color for different cat titles.
May 15, 2018 at 5:06 am #576029DavidStaffCustomer SupportAah ok. Your going to need a plugin, something like this:
May 15, 2018 at 6:13 am #576054sgThanks but not a fan of adding plugin, any snippets to share ? i couldnt find ,thanks
May 15, 2018 at 10:15 am #576329DavidStaffCustomer SupportHi, there isn’t any simple snippets to do this, aside of rewriting all the various templates, it can be done with JS, which is what this plugin uses. As the plugin is only 8kb i think this is the best way to go.
May 15, 2018 at 6:55 pm #576625sgthank you.
let me see if i can strip the codes and add into core child team .May 15, 2018 at 11:00 pm #576742sgHI david. i think the plugin save for different purpose. i need it for the front end view css color.
May 15, 2018 at 11:19 pm #576746sgit would be perfect if i can add this code into my custom page header
is there any workaround for this ?
May 15, 2018 at 11:45 pm #576753sg{{post_terms.taxonomy}}`
May 16, 2018 at 5:06 am #576944DavidStaffCustomer SupportHi SG, there is this:
https://github.com/stuttter/wp-term-colors
The WP repo one is out of date but still runs on 4.9. Alternatively it looks like it has been forked:
May 16, 2018 at 5:45 am #576963sgthanks david that look more like it . but how do i use this plugins ?
it says use meta ” ztc_colored_labels( $taxonomy, $post_id = false, $links = false, $limit = false ); ”
just add this line into function file ?
May 16, 2018 at 6:18 am #576985sgi realised i have snippet that blocking the function
if ( ! function_exists( 'generate_entry_meta' ) ) : /** * Prints HTML with meta information for the categories, tags. * * @since 1.2.5 */ function generate_entry_meta() { $categories = apply_filters( 'generate_show_categories', true ); $tags = apply_filters( 'generate_show_tags', true ); $comments = apply_filters( 'generate_show_comments', true ); $categories_list = get_the_category_list( _x( '', 'Used between list items, there is a space after the comma.', 'generatepress' ) ); if ( $categories_list && $categories ) { printf( '<div class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</div>', _x( 'Categories', 'Used before category names.', 'generatepress' ), $categories_list ); } $tags_list = get_the_tag_list( '', _x( '', 'Used between list items, there is a space after the comma.', 'generatepress' ) ); if ( $tags_list && $tags ) { printf( '<div class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</div>', _x( 'Tags', 'Used before tag names.' ,'generatepress' ), $tags_list ); } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) && $comments ) { echo '<div class="comments-link">'; comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) ); echo '</div>'; } } endif;
how do i add the category name as “css class” in above code ?
that will solve my issue i think. -
AuthorPosts
- You must be logged in to reply to this topic.