• 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

Adding a Widget in Genesis Sample Theme

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 › Design Tips and Tricks › Adding a Widget in Genesis Sample Theme

This topic is: not resolved

Tagged: custom widget

  • This topic has 8 replies, 4 voices, and was last updated 11 years, 1 month ago by Annaedv.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • February 6, 2014 at 10:10 pm #89066
    garyjalbert
    Member

    I am creating a custom website using the Genesis Sample as the child theme, and would like to add a widget to display a slider in the top center of the home page (i.e. just below the header). I am capable of registering the widget, but for some reason I can't get the widget to work. Does anyone know the proper code to make this happen? Once again, I am looking to place a Genesis Responsive Slider just below the header, or just above the entry content.

    Thank you!

    February 6, 2014 at 10:20 pm #89069
    nutsandbolts
    Member

    Once you register the widget, you also need to include a function to tell the widget where to display. In this case, you'd do something like this (but replacing "home-slider" with whatever you named your widget area):

    //* Add the page widget in the content - HTML5
    add_action( 'genesis_before_content_sidebar_wrap', 'nabm_add_widget' );
    function nabm_add_add_widget() {
    	if ( is_home() )
    	genesis_widget_area( 'home-slider', array(
    		'before' => '<div id="home-slider">',
    	) );
    }

    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    February 6, 2014 at 10:40 pm #89076
    garyjalbert
    Member

    Andrea,

    Thank you for the quick reply! So that I am clear, these are both supposed to go in the functions.php file, correct? That's where I placed the registration, and it shows up in my widget display. Anyway, I did plug in your code above, but it's still not showing up? Below is my registration code and the code you provided above. Please let me know if you see a mistake or not. If not, am I supposed to place something in the style.css file?

    //* Register after header widget area
    genesis_register_sidebar( array(
    'id' => 'after-header',
    'name' => __( 'After Header', 'themename' ),
    'description' => __( 'This is a widget area that can be placed after the header', 'themename' ),
    ) );

    //* Add the page widget in the content - HTML5
    add_action( 'genesis_before_content_sidebar_wrap', 'nabm_add_widget' );
    function nabm_add_add_widget() {
    if ( is_home() )
    genesis_widget_area( 'after-header', array(
    'before' => '<div id="after-header">',
    ) );
    }

    Thank you again for your help!

    Gary

    February 6, 2014 at 10:42 pm #89078
    nutsandbolts
    Member

    Yes, that's correct. Both of those should go in functions.php. And I just noticed it's my fault because I have a typo in the function. Try this one:

    //* Add the slider to the homepage
    add_action( 'genesis_before_content_sidebar_wrap', 'nabm_add_widget' );
    function nabm_add_widget() {
    	if ( is_home() )
    	genesis_widget_area( 'home-slider', array(
    		'before' => '<div id="home-slider">',
    	) );
    }

    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    February 6, 2014 at 10:51 pm #89081
    garyjalbert
    Member

    So is this how it should read? If so, it still doesn't appear to be working. I've placed a text widget inside with "Test" inside, and it's not showing up on my home page.

    //* Register after header widget area
    genesis_register_sidebar( array(
    'id' => 'after-header',
    'name' => __( 'After Header', 'themename' ),
    'description' => __( 'This is a widget area that can be placed after the header', 'themename' ),
    ) );

    //* Add the slider to the homepage
    add_action( 'genesis_before_content_sidebar_wrap', 'nabm_add_widget' );
    function nabm_add_widget() {
    if ( is_home() )
    genesis_widget_area( 'after-header', array(
    'before' => '<div id="after-header">',
    ) );
    }

    February 6, 2014 at 10:55 pm #89086
    nutsandbolts
    Member

    That's exactly what it should be, but I'm wondering if you've lost some formatting in copying/pasting from the forum. I'd be glad to log in and take a look if you're comfortable with that. If so, you can email me at [email protected]


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    October 17, 2014 at 3:26 am #128114
    Annaedv
    Participant

    Hello. I´m trying to do the same as you in Genesis Sample.

    1. I try to follow the templates in Studiopress but Genesis Sample does not have a home.php and then I only see the widget in admin. Nothing appears live.

    2. I try to past in your code in functions.php but my pages crasches.

    What to do?
    /Anna

    October 17, 2014 at 3:53 am #128117
    Brad Dalton
    Participant

    Remove the code and try this http://wpsites.net/web-design/widget-genesis/


    Tutorials for StudioPress Themes.

    October 17, 2014 at 5:13 am #128120
    Annaedv
    Participant

    Jabbadabbadoooo! It works! Thank you!
    Anna

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘Design Tips and Tricks’ 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