How to style a WordPress widget area?

I registered a couple new widget areas above my content and below entries, and I’m having trouble styling them. The classes are above_content and after_entry but making an .above_content and .after_entry class in my stylesheet isn’t affecting them. Any ideas? I’m just trying to align then and add padding. My test site

This is the code I used to register the widget area

genesis_register_sidebar( array(
    'id'          => 'after_entry',
    'name'        => __( 'After Entry', 'domain' ),
    'description' => __( 'After Entry', 'domain' ),
) );

add_action( 'genesis_entry_footer', 'your_widget2' );
function your_widget2() {
    if ( is_active_sidebar('after_entry') ) {
        genesis_widget_area( 'after_entry', array(
        'before' => '<div class=“after_entry widget-area">',
        'after'  => '</div>',
        ) ); 
    }
}

Related posts

1 comment

  1. Something is wrong with your HTML,

    <div class="“above_content" widget-area"="">
    <div class="“after_entry" widget-area"="">
    

    that’s why class doesn’t apply.

    It should be like below,

    <div class="above_content widget-area">
    <div class="after_entry widget-area">
    

    You had “, it should be ". check below,

    genesis_register_sidebar( array(
        'id'          => 'after_entry',
        'name'        => __( 'After Entry', 'domain' ),
        'description' => __( 'After Entry', 'domain' ),
    ) );
    
    add_action( 'genesis_entry_footer', 'your_widget2' );
    
    function your_widget2() {
        if ( is_active_sidebar('after_entry') ) {
            genesis_widget_area( 'after_entry', array(
                'before' => '<div class="after_entry widget-area">',
                'after'  => '</div>',
            ) ); 
        }
    }
    

    I hope it helps.

Comments are closed.