<?php
/**
 * アドオン用各ページ表示制御関数
 */

// header!
if ( ! function_exists( 'byakurai_print_header' ) ) {
	/**
	 *
	 */
	function byakurai_print_header( $print = '' ) {
		if ( function_exists( 'byakuraitmp_print_header' ) ) {
			$tmpcontent = byakuraitmp_print_header();
			if ( false !== $tmpcontent ) {
				edit_post_link( __( 'Edit template header', 'byakurai' ), '', '', $tmpcontent );
				return apply_filters( 'byakurai_print_header', $print );
			}
		}

		?>
	<div class="site-branding">
		<?php
		the_custom_logo();
		if ( is_front_page() || is_home() ) :
			?>
			<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
			<?php
			else :
				?>
			<div class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></div>
				<?php
			endif;
			$byakurai_description = get_bloginfo( 'description', 'display' );
			if ( $byakurai_description || is_customize_preview() ) :
				?>
			<div class="site-description"><?php echo $byakurai_description; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
			<?php endif; ?>
	</div><!-- .site-branding -->

	<nav id="site-navigation" class="main-navigation">
		<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><?php esc_html_e( 'Primary Menu', 'byakurai' ); ?></button>
			<?php
			wp_nav_menu(
				array(
					'theme_location' => 'menu-1',
					'menu_id'        => 'primary-menu',
				)
			);
			?>
	</nav><!-- #site-navigation -->
		<?php
		return apply_filters( 'byakurai_print_header', $print );
	}
}

if ( ! function_exists( 'byakurai_print_header_un' ) ) {
	/**
	 *
	 */
	function byakurai_print_header_un( $print = '' ) {
		if ( function_exists( 'byakuraitmp_print_header_un' ) ) {
			$tmpcontent = byakuraitmp_print_header_un();
			if ( false !== $tmpcontent ) {
				edit_post_link( __( 'Edit template under the header', 'byakurai' ), '', '', $tmpcontent );
				return apply_filters( 'byakurai_print_header_un', $print );
			}
		}

		return apply_filters( 'byakurai_print_header_un', $print );
	}
}

// footer!
if ( ! function_exists( 'byakurai_print_footer' ) ) {
	/**
	 *
	 */
	function byakurai_print_footer( $print = '' ) {
		if ( function_exists( 'byakuraitmp_print_footer' ) ) {
			$tmpcontent = byakuraitmp_print_footer();
			if ( false !== $tmpcontent ) {
				edit_post_link( __( 'Edit template footer', 'byakurai' ), '', '', $tmpcontent );
				return apply_filters( 'byakurai_print_footer', $print );
			}
		}
		return apply_filters( 'byakurai_print_footer', $print );
	}
}

// sidebar!
if ( ! function_exists( 'byakurai_print_side_three' ) ) {
	/**
	 *
	 */
	function byakurai_print_side_three( $print = '' ) {
		if ( function_exists( 'byakuraitmp_print_side_three' ) ) {
			$tmpcontent = byakuraitmp_print_side_three();
			if ( false !== $tmpcontent ) {
				return apply_filters( 'byakurai_print_side_three', $print );
			}
		}

		return apply_filters( 'byakurai_print_side_three', $print );
	}
}
if ( ! function_exists( 'byakurai_print_side_four' ) ) {
	/**
	 *
	 */
	function byakurai_print_side_four( $print = '' ) {
		if ( function_exists( 'byakuraitmp_print_side_four' ) ) {
			$tmpcontent = byakuraitmp_print_side_four();
			if ( false !== $tmpcontent ) {
				return apply_filters( 'byakurai_print_side_four', $print );
			}
		}

		return apply_filters( 'byakurai_print_side_four', $print );
	}
}
