Lego2012
1/26/2017 - 2:48 PM

Beaver Builder Theme Hooks Map Function

Beaver Builder Theme Hooks Map Function

<?php

// Paste the following into your Beaver Builder Child Theme's functions.php file to enable an action hooks map on the front-end of your site, visible only to logged in admins

// Display BB action hooks on front-end of site (visible to logged in admins only)
function bb_theme_hooks_map() {

    if ( ! current_user_can( 'administrator' ) )
        return;
    
    $hooks = bb_theme_hooks_array();
    
    foreach ( $hooks as $hook => $value ) {
        
        add_action( '' . $value . '', function() use ( $value ) { echo '<div style="width:100%; background:#0F637D; border-bottom:1px solid #0A3D4F; padding:10px; color:#fff; font-size:18px; font-weight:bold; text-align:center;">' . $value . '</div>'; } );
        
    }
    
}
add_action( 'fl_head', 'bb_theme_hooks_map' );

function bb_theme_hooks_array() {
    
    $hooks = array( 
        'fl_head_open' => 'fl_head_open',
        'fl_head' => 'fl_head',
        'fl_body_open' => 'fl_body_open',
        'fl_page_open' => 'fl_page_open',
        'fl_before_top_bar' => 'fl_before_top_bar',
        'fl_top_bar_col1_open' => 'fl_top_bar_col1_open',
        'fl_top_bar_col1_close' => 'fl_top_bar_col1_close',
        'fl_top_bar_col2_open' => 'fl_top_bar_col2_open',
        'fl_top_bar_col2_close' => 'fl_top_bar_col2_close',
        'fl_after_top_bar' => 'fl_after_top_bar',
        'fl_before_header' => 'fl_before_header',
        'fl_header_content_open' => 'fl_header_content_open',
        'fl_header_content_close' => 'fl_header_content_close',
        'fl_after_header' => 'fl_after_header',
        'fl_before_content' => 'fl_before_content',
        'fl_content_open' => 'fl_content_open',
        'fl_post_top_meta_open' => 'fl_post_top_meta_open',
        'fl_post_top_meta_close' => 'fl_post_top_meta_close',
        'fl_post_bottom_meta_open' => 'fl_post_bottom_meta_open',
        'fl_post_bottom_meta_close' => 'fl_post_bottom_meta_close',
        'fl_comments_open' => 'fl_comments_open',
        'fl_comments_close' => 'fl_comments_close',
        'fl_sidebar_open' => 'fl_sidebar_open',
        'fl_sidebar_close' => 'fl_sidebar_close',
        'fl_content_close' => 'fl_content_close',
        'fl_after_content' => 'fl_after_content',
        'fl_footer_wrap_open' => 'fl_footer_wrap_open',
        'fl_before_footer_widgets' => 'fl_footer_wrap_open',
        'fl_after_footer_widgets' => 'fl_after_footer_widgets',
        'fl_before_footer' => 'fl_before_footer',
        'fl_after_footer' => 'fl_after_footer',
        'fl_footer_col1_open' => 'fl_footer_col1_open',
        'fl_footer_col1_close' => 'fl_footer_col1_close',
        'fl_footer_col2_open' => 'fl_footer_col2_open',
        'fl_footer_col2_close' => 'fl_footer_col2_close',
        'fl_footer_wrap_close' => 'fl_footer_wrap_close',
        'fl_page_close' => 'fl_page_close',
        'fl_body_close' => 'fl_body_close'
    );
    
    return $hooks;
    
}