Skip to content

Instantly share code, notes, and snippets.

@webdev1001
Forked from lmartins/functions.php
Last active August 29, 2015 14:11
Show Gist options
  • Save webdev1001/f62e2303fbaf73fcd9bb to your computer and use it in GitHub Desktop.
Save webdev1001/f62e2303fbaf73fcd9bb to your computer and use it in GitHub Desktop.
Add markup with custom hook that runs inside it
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