• 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

How to enqueue a css file based on the genesis page layout selected

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 › General Genesis Framework Discussions › How to enqueue a css file based on the genesis page layout selected

This topic is: not resolved

Tagged: genesis_site_layout, layout, site_layout

  • This topic has 2 replies, 2 voices, and was last updated 5 months, 1 week ago by Bill.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • March 9, 2022 at 7:38 am #504818
    Bill
    Participant

    OK code gurus out there... I have a need to enqueue a new css file based on the genesis layout selection of "content-sidebar". By default, I will use a Genesis full width layout for the site, but on certain pages, I "MIGHT" want to use "content-sidebar" in the future.

    My actual page design uses a series of column blocks that will need quite a few css tweaks to display properly in mobile screen sizes depending on whether I decide to change page layout from full width to conent-sidebar or vice versa.

    It would just be easier to manage moving forward if I could automatically use a new CSS file when a page, post, or CP is using a content-sidebar layout change.

    Anyone know what the conditional statement would be to enqueue a new css file based on a content-sidebar genesis layout being selected?

    Many thanks in advance for thinking about this one.

    March 9, 2022 at 8:21 am #504819
    Brad Dalton
    Participant

    Maybe this :

     
    $site_layout = genesis_site_layout();
    	
    if ( 'full-width-content' === $site_layout ) {
    
    // Your Code
    
    }
    

    List of layouts


    Recent Client work

    March 9, 2022 at 9:00 am #504820
    Bill
    Participant

    Yes, that worked Brad. Thank you very much!

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2022 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