<?php
/*
 * The template for displaying the footer.
 * Author & Copyright:themexshaper
 * URL: http://themeforest.net/user/themexshaper
 */

$confin_id    = ( isset( $post ) ) ? $post->ID : 0;
$confin_id    = ( is_home() ) ? get_option( 'page_for_posts' ) : $confin_id;
$confin_meta  = get_post_meta( $confin_id, 'page_type_metabox', true );
$confin_ft_bg = cs_get_option('confin_ft_bg');
$confin_attachment = wp_get_attachment_image_src( $confin_ft_bg , 'full' );
$confin_attachment = $confin_attachment ? $confin_attachment[0] : '';

if ( $confin_attachment ) {
	$bg_url = ' style="';
	$bg_url .= ( $confin_attachment ) ? 'background-image: url( '. esc_url( $confin_attachment ) .' );' : '';
	$bg_url .= '"';
} else {
	$bg_url = '';
}

if ( $confin_meta ) {
	$confin_hide_footer  = $confin_meta['hide_footer'];
} else { $confin_hide_footer = ''; }
if ( !$confin_hide_footer ) { // Hide Footer Metabox
	$hide_copyright = cs_get_option('hide_copyright');
?>
	<!-- Footer -->
	<footer class="site-footer" <?php echo wp_kses( $bg_url, array('img' => array('src' => array(), 'alt' => array()),) ); ?>>
		<?php
			$footer_widget_block = cs_get_option( 'footer_widget_block' );
			if ( $footer_widget_block ) {
	      get_template_part( 'theme-layouts/footer/footer', 'widgets' );
	    }
			if ( !$hide_copyright ) {
      	get_template_part( 'theme-layouts/footer/footer', 'copyright' );
	    }
    ?>
	</footer>
	<!-- Footer -->
<?php } // Hide Footer Metabox ?>
</div><!--confin-theme-wrapper -->
<?php wp_footer(); ?>
</body>
</html>
