<?php
/**
 * The template for displaying the footer.
 *
 * Contains the closing of the #content div and all content after.
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package tm-9studio
 */

?>
</div><!-- /.content -->
<?php
// Newsletter section
if ( is_search() || ( Insight_Helper::get_post_meta( 'newsletter_visibility' ) === 'default' ) || ( Insight_Helper::get_post_meta( 'newsletter_visibility' ) === '' ) ) {
	$show_newsletter = Insight::setting( 'newsletter_visibility' );
} else {
	$show_newsletter = Insight_Helper::get_post_meta( 'newsletter_visibility' ) === 'visible' ? '1' : '0';
}
if ( $show_newsletter === '1' ) {
	get_template_part( 'components/newsletter' );
}

// Footer section
$show_footer    = '1';
$show_copyright = '';
$footer_enable  = Insight_Helper::get_post_meta( 'footer_visibility', 'default' );

switch ( $footer_enable ) {
	case 'default';
		if ( Insight::setting( 'footer_visibility' ) === true ) {
			$show_footer = '1';
		} else {
			$show_footer = '0';
		}
		break;
	case 'visible';
		$show_footer = '1';
		break;
	case 'hidden';
		$show_footer = '0';
		break;
}

if ( $show_footer === '1' ) {
	get_template_part( 'components/footer' );
}

// Copyright section
if ( Insight_Helper::get_post_meta( 'copyright_visibility' ) === 'default' ) {
	if ( Insight::setting( 'copyright_visibility' ) === true ) {
		$show_copyright = '1';
	} else {
		$show_copyright = '0';
	}
} elseif ( Insight_Helper::get_post_meta( 'copyright_visibility' ) === 'visible' ) {
	$show_copyright = '1';
} elseif ( Insight_Helper::get_post_meta( 'copyright_visibility' ) === 'hidden' ) {
	$show_copyright = '0';
}

if ( $show_copyright === '1' ) {
	get_template_part( 'components/copyright', Insight::setting( 'copyright_type' ) );
}
?>
</div><!-- /.site -->

<?php wp_footer(); ?>

</body>
</html>
