I am having an issue where my sidebars are not displayed when proper condition is selected. I have tested conditions and they works but sidebars are still not processed for some reason. I was working 3 days on solution for this and I am stuck. I will need help please.

All this functions are in the same file in functions folder called sidebars.php

<?php
add_action('widgets_init', 'myteam_load_sidebar_names');
add_action('widgets_init', 'myteam_register_all_sidebars' );   

function myteam_load_sidebar_names(){
    global $myteam_data, $options_theme;


    if($options_theme['options_footer_number_cols'] == "one")
        $myteam_data->myteam_footer_sidebars=array(array('name'=>'Footer One Column', 'id'=>'footer-one-column'));
    if($options_theme['options_footer_number_cols'] == "two")
        $myteam_data->myteam_footer_sidebars=array(array('name'=>'Footer Left Column', 'id'=>'footer-two-column-left'), array('name'=>'Footer Right Column', 'id'=>'footer-two-column-right'));
    if($options_theme['options_footer_number_cols'] == "three") {
        if($options_theme['options_footer_columns_order'] == "one_three")
            $myteam_data->myteam_footer_sidebars=array(array('name'=>'Footer Left Column', 'id'=>'footer-three-column-left'), array('name'=>'Footer Center Column', 'id'=>'footer-three-column-center'), array('name'=>'Footer Right Column', 'id'=>'footer-three-column-right'));
        if($options_theme['options_footer_columns_order'] == "one_two_three")
            $myteam_data->myteam_footer_sidebars=array(array('name'=>'Footer Left Column (1/3)', 'id'=>'footer-three-column-left-1_3'), array('name'=>'Footer Right Column (2/3)', 'id'=>'footer-three-column-right-2_3'));
        if($options_theme['options_footer_columns_order'] == "two_one_three")
            $myteam_data->myteam_footer_sidebars=array(array('name'=>'Footer Left Column (2/3)', 'id'=>'footer-three-column-left-2_3'), array('name'=>'Footer Right Column (1/3)', 'id'=>'footer-three-column-right-1_3'));
    }
}

function myteam_register_all_sidebars(){
    global $myteam_data;

    if (isset($myteam_data->myteam_footer_sidebars))
        $myteam_footer_sidebars=$myteam_data->myteam_footer_sidebars;
    else $myteam_footer_sidebars = array();

    if (function_exists('register_sidebar')){
        if ( $myteam_footer_sidebars && ! is_wp_error( $myteam_footer_sidebars ) ) {
        //register the footer column sidebars
            foreach($myteam_footer_sidebars as $sidebar){
                myteam_register_footer_sidebar( $sidebar['name'], $sidebar['id']);
            }
        }
    }
}


/**
 * Registers a footer column sidebar.
 * @param $name the name of the sidebar
 * @param $id the id of the sidebar
 */
function myteam_register_footer_sidebar($name, $id){
    register_sidebar(array(
        'name'=> $name,
        'id' => $id,
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '<h4>',
        'after_title' => '</h4><hr/>',
    ));
}


/**
 * Prints a sidebar.
 * @param $name the name of the sidebar to print
 */
function print_sidebar($name){
    if ( function_exists('dynamic_sidebar')) { 
        $html = dynamic_sidebar($name);
        des_content_shortcoder($html);
        do_shortcode($html);
    }
}

function des_get_sidebar($name){
    if ( function_exists('dynamic_sidebar')) { 
        ob_start();
        do_shortcode(dynamic_sidebar($name));
        $html = ob_get_contents();
        ob_end_clean();
        return $html;  
    }
}

/**
 * Prints a footer sidebar column.
 * @param $name the name of the sidebar
 * @param $last if true, then this is the last column
 */
function print_footer_sidebar($name, $last){
    $class=$last?'four-columns nomargin':'four-columns';
    ?>
    <div class="<?php echo $class; ?>"><?php     
    if (function_exists('dynamic_sidebar')) { 
        do_shortcode(dynamic_sidebar($name));
    } ?></div>
<?php
}
?>

And I am calling it on footer.php page as:

<?php print_sidebar('footer-two-column-left'); ?>

etc.

My sidebar doesn’t show not even in the sidebars section in backend.

Read more here: Sidebars that depend on specific Redux option.


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: