Created
September 10, 2017 04:29
-
-
Save topleague/7174abac4966933e581d3582fafd086b to your computer and use it in GitHub Desktop.
Create and Display Custom Widgets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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