[Support request] category tag color

Home Forums Support [Support request] category tag color

Home Forums Support category tag color

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #575785
    sg

    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.

    #575971
    David
    Staff
    Customer Support

    Hi there, have you resolved this issue? I can see each of your category links have a blue background.

    #576025
    sg

    hi David,

    no i am looking at coloring different color for different cat titles.

    #576029
    David
    Staff
    Customer Support

    Aah ok. Your going to need a plugin, something like this:

    https://wordpress.org/plugins/colorful-categories/

    #576054
    sg

    Thanks but not a fan of adding plugin, any snippets to share ? i couldnt find ,thanks

    #576329
    David
    Staff
    Customer Support

    Hi, 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.

    #576625
    sg

    thank you.
    let me see if i can strip the codes and add into core child team .

    #576742
    sg

    HI david. i think the plugin save for different purpose. i need it for the front end view css color.

    #576746
    sg

    it would be perfect if i can add this code into my custom page header

    is there any workaround for this ?

    #576753
    sg

    {{post_terms.taxonomy}}`

    #576944
    David
    Staff
    Customer Support

    Hi 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:

    https://wordpress.org/plugins/zerowp-term-colors/

    #576963
    sg

    thanks 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 ?

    #576985
    sg

    i 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.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.