Skip to content

Instantly share code, notes, and snippets.

@topleague
Created September 10, 2017 04:29
Show Gist options
  • Save topleague/7174abac4966933e581d3582fafd086b to your computer and use it in GitHub Desktop.
Save topleague/7174abac4966933e581d3582fafd086b to your computer and use it in GitHub Desktop.
Create and Display Custom Widgets
// ADD THE FOLLOWING CODE TO YOU FUNCTIONS.PHP FILE
// Register a new widget area
genesis_register_sidebar( array(
'id' => 'your-widget-name',
'name' => __( 'Your Widget Name', 'genesis' ),
'description' => __( 'This is your widget section.', 'genesis' ),
) );
// ADD THE FOLLOWING CODE TO YOU FRONT-PAGE.PHP OR ANY OTHRE CUSTOM TEMPLATE FILE
//* Hook the new widget area
add_action( 'genesis_loop', 'your_widget_function' );
function your_widget_function() {
genesis_widget_area( 'your-widget-name', array(
'before' => '<div class="your-widget-class">',
'after' => '</div>',
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment