C C

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Custom Body Class Places Category #364977

    C C
    Free User
    Post count: 3
    This reply has been marked as private.
    in reply to: Custom Body Class Places Category #364871

    C C
    Free User
    Post count: 3

    Hello Stiofan,
    Thanks for your response. You’ve pointed me in the right direction. Actually I was wanting to set the body class depending on which category the Place was in. Using the function

    is_tax('gd_placecategory', 'taxonomy term')

    For me the taxonomy term works so if my Places Category is for example “shops” then the following would detect the Category of ‘shops’ and insert the class of XXXshopsXXX in the body class.

    
    
    function my_custom_body_class_in_category( $classes ) {
        if ( is_tax( 'gd_placecategory','shops' ) ){
            $classes[] = 'XXXshopsXXX';
    	} elseif ( is_tax( 'gd_placecategory','stay' ) ){
    		 $classes[] = 'XXXstayXXX';
    	} elseif  ( is_tax( 'gd_placecategory','services' ) ){
    		$classes[] = 'XXXservicesXXX';
    	} else{
    		// do something else 
    	}
    		
        // return the modified $classes array
        return $classes;
    }
    add_filter( 'body_class','my_custom_body_class_in_category' );

    Thanks for your input !

    CC

    in reply to: Custom Body Class Places Category #364808

    C C
    Free User
    Post count: 3
    This reply has been marked as private.
Viewing 3 posts - 1 through 3 (of 3 total)
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount