lmartins
10/29/2014 - 4:12 PM

Add markup with custom hook that runs inside it

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' );