<?php function serpentsoft_sidebars_footer_dynamic() {

    $footerLayout = serpentsoft_get_data('serpentsoft_footerlayout');

    $before_widget = '<div id="%1$s" class="f-widget %2$s"><div class="widget-content clearfix padding20">';
    $before_title = '</div><div class="f-widget-title"><h4>';
    $after_title = '</h4></div><div class="f-widget-content clearfix">';
    $after_widget = '</div></div>';

    if ($footerLayout != 'f-none') {

        // First Footer Sidebar
        register_sidebar(array(
            'name' => __('Footer Sidebar #1', 'serpentsoft'),
            'id' => 'footer-first-sidebar',
            'description' => __('First footer sidebar', 'serpentsoft'),
            'before_widget' => $before_widget, 'before_title' => $before_title, 'after_title' => $after_title, 'after_widget' => $after_widget,
        ));

        if ($footerLayout == 'f-13c-left' || $footerLayout == 'f-13c-right' || $footerLayout == 'f-3c' || $footerLayout == 'f-2c' || $footerLayout == 'f-2c-left' || $footerLayout == 'f-2c-right' || $footerLayout == 'f-4c') {
            // Second Footer Sidebar
            register_sidebar(array(
                'name' => __('Footer Sidebar #2', 'serpentsoft'),
                'id' => 'footer-second-sidebar',
                'description' => __('Second footer sidebar', 'serpentsoft'),
                'before_widget' => $before_widget, 'before_title' => $before_title, 'after_title' => $after_title, 'after_widget' => $after_widget,
            ));
        }

        if ($footerLayout == 'f-3c' || $footerLayout == 'f-2c-left' || $footerLayout == 'f-2c-right' || $footerLayout == 'f-4c') {
            // Third Footer Sidebar
            register_sidebar(array(
                'name' => __('Footer Sidebar #3', 'serpentsoft'),
                'id' => 'footer-third-sidebar',
                'description' => __('Second footer sidebar', 'serpentsoft'),
                'before_widget' => $before_widget, 'before_title' => $before_title, 'after_title' => $after_title, 'after_widget' => $after_widget,
            ));
        }

        if ($footerLayout == 'f-4c') {
            // Fourth Footer Sidebar
            register_sidebar(array(
                'name' => __('Footer Sidebar #4', 'serpentsoft'),
                'id' => 'footer-fourth-sidebar',
                'description' => __('Fourth footer sidebar', 'serpentsoft'),
                'before_widget' => $before_widget, 'before_title' => $before_title, 'after_title' => $after_title, 'after_widget' => $after_widget,
            ));
        }
    }
}

function serpentsoft_sidebars_topMenu_dynamic() {

    $topMenuLayout = serpentsoft_get_data('serpentsoft_top_menu_layout');
    /* 'name' => __('Top Menu Wide Sidebar', 'serpentsoft'),
    'id' => 'tm-wide-sidebar',
    'description' => __('Appears on Top Menu', 'serpentsoft'),
    'before_widget' => '<div id="%1$s" class="clearfix %2$s">',
    'before_title' => '<div class="title"><h3>',
    'after_title' => '</h3><hr /></div><div class="widget-content clearfix">',
    'after_widget' => '</div></div>' */
            
    $before_widget = '<div id="%1$s" class="tm-widget clearfix %2$s"><div class="widget-content clearfix padding20">';
    $before_title = '</div><div class="title"><h3>';
    $after_title = '</h3><hr /></div><div class="widget-content clearfix">';
    $after_widget = '</div></div>';

    if ($topMenuLayout != 'f-none') {

        /* First Top Menu Sidebar */
        register_sidebar(array(
            'name' => __('Top Menu Sidebar #1', 'serpentsoft'),
            'id' => 'tm-first-sidebar',
            'description' => __('First Tob Menu Sidebar', 'serpentsoft'),
            'before_widget' => $before_widget, 'before_title' => $before_title, 'after_title' => $after_title, 'after_widget' => $after_widget,
        ));

        /* Second Top Menu Sidebar */
        if ( $topMenuLayout == 'f-13c-left' || $topMenuLayout == 'f-13c-right' || $topMenuLayout == 'f-3c' ) {
            register_sidebar(array(
                'name' => __('Top Menu Sidebar #2', 'serpentsoft'),
                'id' => 'tm-second-sidebar',
                'description' => __('Second Top Menu Sidebar', 'serpentsoft'),
                'before_widget' => $before_widget, 'before_title' => $before_title, 'after_title' => $after_title, 'after_widget' => $after_widget,
            ));
        }
        
        /* Third Top Menu Sidebar */
        if ($topMenuLayout == 'f-3c') {    
            register_sidebar(array(
                'name' => __('Top Menu Sidebar #3', 'serpentsoft'),
                'id' => 'tm-third-sidebar',
                'description' => __('Third Top Menu Sidebar', 'serpentsoft'),
                'before_widget' => $before_widget, 'before_title' => $before_title, 'after_title' => $after_title, 'after_widget' => $after_widget,
            ));
        }
    }
} ?>