<?php 
global $anps_page_data;
if(!is_404()) {
    $footer_value = get_post_meta(get_the_ID(), $key ='anps_footer_type', $single = true ); 
    $footer_disable_value = get_post_meta(get_the_ID(), $key ='anps_footer_disable', $single = true );
} else {
    $footer_value = "";
    $footer_disable_value = "";
}
if(isset($anps_page_data['footer_style'])) {
    $footer_columns_value = $anps_page_data['footer_style']; 
} else {
    $footer_columns_value = "0";
}
if(isset($anps_page_data['copyright_footer'])) {
    $copyright_footer = $anps_page_data['copyright_footer'];
} else {
    $copyright_footer = "0";
}
if($footer_disable_value!="") {
    $footer_disable = $footer_disable_value;
} elseif(($footer_disable_value!="" || $footer_value=="" || $footer_value=="0") && isset($anps_page_data['footer_disable'])) {
    $footer_disable = $anps_page_data['footer_disable'];
} else {
    $footer_disable = "";
} 
if($footer_value!="" && $footer_value!="0") {
    $footer_columns = $footer_value;
} else {
    $footer_columns = $footer_columns_value;
}
?>
<footer id="site-footer" class="site-footer <?php if($footer_disable==""){echo "style-2";} ?>">
    <?php if($footer_disable=="") : ?>
    <div class="container footer-widgets">
        <div class="row">
            <?php if($footer_columns=='2') : ?>
                <div class="col-md-6"><ul class="widgets"><?php do_shortcode(dynamic_sidebar( 'footer-1' )); ?></ul></div>
                <div class="col-md-6"><ul class="widgets"><?php do_shortcode(dynamic_sidebar( 'footer-2' )); ?></ul></div>
            <?php elseif($footer_columns=='3') : ?>
                <div class="col-md-4"><ul class="widgets"><?php do_shortcode(dynamic_sidebar( 'footer-1' )); ?></ul></div>
                <div class="col-md-4"><ul class="widgets"><?php do_shortcode(dynamic_sidebar( 'footer-2' )); ?></ul></div>
                <div class="col-md-4"><ul class="widgets"><?php do_shortcode(dynamic_sidebar( 'footer-3' )); ?></ul></div>
            <?php elseif($footer_columns=='4' || $footer_columns=='0') : ?>
                <div class="col-md-3"><ul class="widgets"><?php do_shortcode(dynamic_sidebar( 'footer-1' )); ?></ul></div>
                <div class="col-md-3"><ul class="widgets"><?php do_shortcode(dynamic_sidebar( 'footer-2' )); ?></ul></div>
                <div class="col-md-3"><ul class="widgets"><?php do_shortcode(dynamic_sidebar( 'footer-3' )); ?></ul></div>
                <div class="col-md-3"><ul class="widgets"><?php do_shortcode(dynamic_sidebar( 'footer-4' )); ?></ul></div>
            <?php endif; ?>
	</div>
    </div>
    <?php endif; ?>
    <div class="copyright">
        <div class="container">
            <div class="row">
                <?php if($copyright_footer=="1" || $copyright_footer=="0") : ?>
                    <ul class="text-center"><?php do_shortcode(dynamic_sidebar( 'copyright-1' )); ?></ul>
                <?php elseif($copyright_footer=="2") : ?>
                    <div class="col-md-6"><ul><?php do_shortcode(dynamic_sidebar( 'copyright-1' )); ?></ul></div>
                    <div class="col-md-6 text-right"><ul><?php do_shortcode(dynamic_sidebar( 'copyright-2' )); ?></ul></div>
                <?php endif; ?>
            </div>
        </div>
    </div>
</footer>