Viewing 4 posts - 1 through 4 (of 4 total)
  • Posted in: Supreme
  • #166631
    acrncevi
    Member
    Post count: 61

    Hi,

    Sometimes I had to publish one article in multiple categories. On the cover below the title name appears every category. That looks quite confusing. I wonder if there is a way of displaying only one category of cloud regardless of the fact the text was published in several categories?

    Attachments:
    You must be logged in to view attached files.
    #166821
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please open to edit functions.php

    Find this code:-
    function sf_get_custom_post_cat_list($postID) {
    	
    		$post_categories = wp_get_post_categories( $postID );
    		$output = '';
    						
    		foreach( $post_categories as $category ){
    			$cat = get_category( $category );
    			$colour = get_tax_meta($cat->term_id,'sf_tax_category_color');
    			$category_link = get_category_link( $cat->cat_ID );
    			$output .= '<a class="cat-item" style="background-color:'.$colour.';" href="'.$category_link.'">'.$cat->name.'</a>';
    		}			
    		
    		return $output;
    		
    	}
    
    Change with:-
    function sf_get_custom_post_cat_list($postID) {
    	
    		$post_categories = wp_get_post_categories( $postID );
    		$output = '';
    						
    		
    			$cat = get_category( $post_categories[0] );
    			$colour = get_tax_meta($cat->term_id,'sf_tax_category_color');
    			$category_link = get_category_link( $cat->cat_ID );
    			$output .= '<a class="cat-item" style="background-color:'.$colour.';" href="'.$category_link.'">'.$cat->name.'</a>';
    				
    		
    		return $output;
    		
    	}

    Thanks
    Mohammad
    Mohammad

    #168775
    acrncevi
    Member
    Post count: 61

    Thank you. You are excellent. I have already recommended your company to everyone for the brilliant support.

    #168807
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Great. Thansk for that.
    Thanks Mohammad.

    -Rui

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register