Skip to content

Instantly share code, notes, and snippets.

@nutsandbolts
Created November 5, 2015 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nutsandbolts/5b639c9ea14e67357f34 to your computer and use it in GitHub Desktop.
Save nutsandbolts/5b639c9ea14e67357f34 to your computer and use it in GitHub Desktop.
Add two unique page widgets to two different pages
<?php // do NOT include this line in your functions.php file
//* Register widget areas
genesis_register_sidebar( array(
'id' => 'page-widget-1',
'name' => __( 'Page Widget 1', 'nabm' ),
'description' => __( 'This is the widget area for a specific page.', 'nabm' ),
) );
genesis_register_sidebar( array(
'id' => 'page-widget-2',
'name' => __( 'Page Widget 2', 'nabm' ),
'description' => __( 'This is the widget area for a different page.', 'nabm' ),
) );
//* Hook page widget areas below the entry content
add_action( 'genesis_entry_footer', 'nabm_add_page_content' );
function nabm_add_page_content() {
if ( is_page('ID') ) // don't forget your page ID
genesis_widget_area ('page-widget-1', array(
'before' => '<div class="page-widget-1"><div class="wrap">',
'after' => '</div></div>',
) );
}
add_action( 'genesis_entry_footer', 'nabm_add_more_page_content' );
function nabm_add_more_page_content() {
if ( is_page('ID') ) // don't forget your page ID
genesis_widget_area ('page-widget-2', array(
'before' => '<div class="page-widget-2"><div class="wrap">',
'after' => '</div></div>',
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment