• Resolved FeralReason

    (@feralreason)


    I created a page-fullwidth.php template in my 2013 childtheme by copying over page.php and deleting <?php get_sidebar(); ?>, but I still get the “sidebar” class showing up in my body tag.

    I would like to get rid of this to make styling easier. Any idea how to prevent this “sidebar” class from being added?

    Thanks!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • edit functions.php of the child theme (or create a new one http://codex.wordpress.org/Child_Themes#Using_functions.php ) and add for example:

    function twentythirteenchild_body_class( $classes ) {
    
    	if ( is_page_template('page-fullwidth.php') )
    	foreach($classes as $key => $value) {
          if ($value == 'sidebar') unset($classes[$key]);
          }
    	return $classes;
    }
    add_filter( 'body_class', 'twentythirteenchild_body_class', 20 );
    Thread Starter FeralReason

    (@feralreason)

    alchymyth – Excellent! That’s exactly what I needed. Works seamlessly.

    Thanks much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Prevent "sidebar" body class from being added to full-width template.’ is closed to new replies.