• I located and tried the following code in my child theme’s functions.php file. The intent is to remove the “full-width” body class when the vulcan-page.php template is used. That would allow the vulcan sidebar to fit nicely.

    add_filter('body_class', 'remove_a_body_class', 10, 2);
    function remove_a_body_class($wp_classes) {
    if( is_page_template('vulcan-page.php') ) :
          foreach($wp_classes as $key => $value) {
          if ($value == 'full-width') unset($wp_classes[$key]);
          }
    endif;
    return $wp_classes;

    }

    Site: http://angelxray.com
    The page in question: Vulcans are rather weird

    However, it does not work; I assume I am doing something wrong but I cannot find it. Any help would be most gratefully appreciated!

The topic ‘Cannot remove a single body class for given template’ is closed to new replies.