Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author Ben Sibley

    (@bensibley)

    Thanks for using Mission News!

    The steps are very similar to the other thread. Make sure you download a child theme first and then add this code to the functions.php file:

    function mission_news_cpt_layout_class( $classes ) {
    
    	if ( is_singular( 'word' ) ) {
    		$classes[] = 'layout-right-sidebar-wide';
    	} 
    	return $classes;
    }
    add_filter( 'body_class', 'mission_news_cpt_layout_class' );

    That will style the layout correctly on all of the CPT pages.

    And then copy the sidebar-left.php file into the child theme and add this code to the very top:

    if ( is_singular( 'word' ) ) {
      return;
    }

    That will remove the left sidebar.

    There’s one more change you need to make for this to work. I’ve left “word” in two places above – that is the slug for the custom post type. I don’t know what your CPT slug is so I can’t add it into the code right now, so please just make sure to replace both instances of “word” with your CPT’s slug.

    Thread Starter redegg153

    (@redegg153)

    Perfect, that did it! I was just missing the right name for the layout (layout-right-sidebar-wide), though I probably should have been able to intuit that. ??

    Regardless, works great now, thank you!

    Theme Author Ben Sibley

    (@bensibley)

    Awesome! Happy to help ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom post types right-sidebar-wide?’ is closed to new replies.