• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Change Layout based on Post Type

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Change Layout based on Post Type

This topic is: not a support question

Tagged: full width, Post Type, Sidebar

  • This topic has 2 replies, 2 voices, and was last updated 7 years, 3 months ago by eddie.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • November 14, 2015 at 10:19 am #171083
    eddie
    Participant

    I threw this together and it seems to be working ok. I figured somebody else might find it useful.

    The purpose is to force a sidebar if displaying a particular post type. Make sure you identify the post slug for your particular post type and replace "__-slug".

    Finally, I left in the three layout options. I couldn't find any documentation on this, so I fiddled with it until I got it right 😉

    November 30, 2015 at 8:07 am #172264
    Brad Dalton
    Participant

    You could also use:

    if ( is_singular( 'your-cpt'))
    

    Rather than:

    if ( get_post_type($post) == '__-slug' && !is_archive())
    

    Swap out your-cpt with the name of your custom post type.


    Tutorials for StudioPress Themes.

    December 2, 2015 at 5:35 pm #172535
    eddie
    Participant

    I like that, considerably more clean. Thanks.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble