How to STYLE individual CATEGORIES and SUB CATEGORIES

Community Forums Forums Design Tips and Tricks How to STYLE individual CATEGORIES and SUB CATEGORIES

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  PhilMurray 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #73541

    PhilMurray
    Participant
    Post count: 41

    hi

    I need to style a specific CATEGORY and all it’s SUB CATEGORIES and POSTS differently to the rest of the site a for a client build.

    I tried this excellent code from Nick Croft [below] – which works great for CATEGORIES and POSTS – but how do I include SUB CATEGORIES also?

    //adds new body class for post category
    add_filter(‘body_class’, ‘add_category_class_single’);
    function add_category_class_single($classes){

    global $post;

    if(is_single()) {
    $category = get_the_category($post->ID);
    $slug = $category[0]->slug;
    $classes[] = ‘post-category-’ . $slug;
    }

    return $classes;
    }

    #91167

    Susan
    Moderator
    Post count: 7985

    Since you posted this a while ago, I hope you were able to get a resolution to your issue. If not, please report back here, and I will try to assist, or escalate as appropriate.

    Thanks!


    Susan @ Graphically Designing I’d love to customize your website! I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

    #91249

    PhilMurray
    Participant
    Post count: 41

    Thanks Susan

    no didn’t get properly resolved as such

    cheers

    Phil

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

You must be logged in to reply to this topic.