Created
October 29, 2014 16:12
-
-
Save lmartins/8984cbf38eb27ea1810b to your computer and use it in GitHub Desktop.
Add markup with custom hook that runs inside it
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
add_action( 'genesis_after', 'mw_add_offcanvas' ); | |
function mw_add_offcanvas() | |
{ | |
$out = '<div class="shifter-navigation Sidebar-offcanvas">'; | |
/** | |
* Using this hook: | |
* mw_add_offcanvas_sidebar | |
* mw_offcanvas_menu | |
*/ | |
ob_start(); | |
do_action( 'mw_inside_offcanvas' ); | |
$out .= ob_get_contents(); | |
ob_get_clean(); | |
$out .= '</div>'; | |
echo $out; | |
} | |
function mw_add_offcanvas_sidebar() { | |
genesis_widget_area( 'sidebar-navigation', array( | |
'before' => '<div class="widget-area">', | |
'after' => '</div>', | |
) ); | |
} | |
add_action( 'mw_inside_offcanvas', 'mw_add_offcanvas_sidebar' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment