Title: Layout for Custom Post Types
Last modified: November 28, 2018

---

# Layout for Custom Post Types

 *  Resolved [Johnny](https://wordpress.org/support/users/johnny18sg/)
 * (@johnny18sg)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/layout-for-custom-post-types/)
 * Dear Ben,
 * I created a Custom Post Type (CPT) called **word**. Unlike posts, I am not able
   to set the Layout to “No Sidebar” in the Customizer.
 * The link provided shows the single post of **word** with the right and left sidebars.
 * How do I change the Layout to “No Sidebar” for this CPT?
 * Appreciate your help.
 * Thank you.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Flayout-for-custom-post-types%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Theme Author [Ben Sibley](https://wordpress.org/support/users/bensibley/)
 * (@bensibley)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/layout-for-custom-post-types/#post-10927601)
 * Hi Johnny,
 * Are you familiar with writing and editing PHP? I can point you in the right direction
   to edit this code, but I’m afraid there isn’t currently an option in Mission 
   News for changing the layouts of custom post types.
 *  Thread Starter [Johnny](https://wordpress.org/support/users/johnny18sg/)
 * (@johnny18sg)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/layout-for-custom-post-types/#post-10927908)
 * Yes, I am familiar with php. Please direct me.
 * Thank you.
 *  Theme Author [Ben Sibley](https://wordpress.org/support/users/bensibley/)
 * (@bensibley)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/layout-for-custom-post-types/#post-10930819)
 * Okay great!
 * The first step is to activate a child theme. You can download a starter child
   theme for Mission News here: [https://www.competethemes.com/help/child-theme-mission-news/](https://www.competethemes.com/help/child-theme-mission-news/)
 * Then add this function into the functions.php file:
 *     ```
       function mission_news_cpt_layout_class( $classes ) {
   
       	if ( is_singular( 'word' ) ) {
       		$classes[] = 'layout-no-sidebar';
       	} 
       	return $classes;
       }
       add_filter( 'body_class', 'mission_news_cpt_layout_class' );
       ```
   
 * You might have to rename “word” to the exact string you named your CPT with. 
   That function is going to apply the no sidebar styles to the CPT pages.
 * Next, copy both the `sidebar-left.php` and `sidebar-right.php` files into the
   child theme. Then add this to the top of both files:
 *     ```
       if ( is_singular( 'word' ) ) {
         return;
       }
       ```
   
 * That will prevent the sidebars from being output on the CPT pages. Again, the
   string “word” might need to be adjusted here.
 *  Thread Starter [Johnny](https://wordpress.org/support/users/johnny18sg/)
 * (@johnny18sg)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/layout-for-custom-post-types/#post-10932346)
 * Works perfectly!
 * Thank you much for taking time to help me 🙂
 *  Theme Author [Ben Sibley](https://wordpress.org/support/users/bensibley/)
 * (@bensibley)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/layout-for-custom-post-types/#post-10934091)
 * You’re welcome! Glad I could help.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Layout for Custom Post Types’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/mission-news/1.65/screenshot.png)
 * Mission News
 * [Support Threads](https://wordpress.org/support/theme/mission-news/)
 * [Active Topics](https://wordpress.org/support/theme/mission-news/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/mission-news/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/mission-news/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Ben Sibley](https://wordpress.org/support/users/bensibley/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/layout-for-custom-post-types/#post-10934091)
 * Status: resolved