[Resolved] Custom Body Class

Home Forums Support Custom Body Class

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

    Hi all,

    I’m trying to add a cusotm body class to a Custom Post Type Archive using the filter below in my child themes functions file, but it’s not working:

    //* Add custom body class to CPT Archive
    add_filter( 'body_class', 'custom_body_class' );
    function custom_body_class( $classes ) {
    	if ( is_post_type_archive( 'courses' )  )
    		$classes[] = 'all-courses';
    		return $classes;

    Any idea where I’m going wrong?


    Nevermind, I just realised the archive is plugin generated not theme generated! Doh!

    Customer Support

    Glad you’ve figured out 🙂

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