• 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

Genesis ignores sidebar classes?

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 › Genesis ignores sidebar classes?

This topic is: not resolved

Tagged: sidebars, widgets

  • This topic has 2 replies, 2 voices, and was last updated 12 years, 3 months ago by DanielJLewis.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • August 29, 2013 at 8:47 am #59531
    DanielJLewis
    Member

    I'm registering widgets with genesis_register_sidebar using the WordPress syntax, including "class":

    genesis_register_sidebar( array(
    	'id' => 'top-feature-full',
    	'name' => 'Top Feature Full Width',
    	'description' => 'This is the Top Feature Full Width section',
    	'class' => 'testclass'
    ) );

    But the class is completely ignored when the widget area is placed in my theme with genesis_widget_area( 'top-feature-full' );.

    The widget shows just fine, but the class is never carried over. This is really important for me. I even tried using WordPress's dynamic_sidebar with register_sidebar, but the class was still nowhere in the HTML.

    For development, this means I have to write:

    <?php if ( is_active_sidebar('top-feature-full') ) { ?>
    	<div class="testclass">
    		<?php genesis_widget_area( 'top-feature-full' ); ?>
    	</div>
    <?php }

    But if the class key worked, I could condense the above into:

    <?php genesis_widget_area( 'top-feature-full' ); ?>

    I don't know whether this is a WordPress problem or a Genesis problem, but I would appreciate your help.

    August 30, 2013 at 10:11 am #59704
    Sridhar Katakam
    Participant

    There are two ways from what I can see.

    1) Use the WP's register_sidebar instead of Genesis specific genesis_register_sidebar.

    Set your class in the value of 'before_widget'.

    Ex.:

    register_sidebar(array(
      'name' => __( 'Right Hand Sidebar' ),
      'id' => 'right-sidebar',
      'description' => __( 'Widgets in this area will be shown on the right-hand side.' ),
      'before_widget' => '<div class="testclass widget-area">',
      'after_widget'  => '</div>',
      'before_title' => '<h4>',
      'after_title' => '</h4>'
    ));

    to display the content of above sidebar, you would use:

    dynamic_sidebar( 'right-sidebar' );

    2) Register your sidebar using genesis_register_sidebar and add markup like so:

    genesis_widget_area( 'right-sidebar', array(
    			'before'=> '<div class="testclass widget-area">',
    			'after'	=> '</div>',
    		) );

    Genesis Tutorials | Follow me on Twitter

    August 30, 2013 at 10:15 am #59706
    DanielJLewis
    Member

    Thanks for the reply, but neither of those suggestions would work. As I said, I already tried the WordPress methods over the Genesis methods. Same result.

    "before_widget" won't work because that adds the code around each widget, when I want the whole widget area with the class.

    StudioPress responded to a support ticket about this saying I could use "before," but that means adding extra HTML markup.

    Why can't I just use the built-in "class" to add that class to the existing widget area markup?

  • 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

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