-
-
Save nutsandbolts/5b639c9ea14e67357f34 to your computer and use it in GitHub Desktop.
Add two unique page widgets to two different pages
This file contains 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
<?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