<?php
/**
 * Theme functions related to structure.
 *
 * This file contains structural hook functions.
 *
 * @package DarkMag
 */

if ( ! function_exists( 'darkmag_doctype' ) ) :
	/**
	 * Doctype Declaration.
	 *
	 * @since 1.0.0
	 */
function darkmag_doctype() {
	?><!DOCTYPE html> <html <?php language_attributes(); ?>><?php
}
endif;

add_action( 'darkmag_action_doctype', 'darkmag_doctype', 10 );


if ( ! function_exists( 'darkmag_head' ) ) :
	/**
	 * Header Codes.
	 *
	 * @since 1.0.0
	 */
function darkmag_head() {
	?>
	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="profile" href="http://gmpg.org/xfn/11">
	<?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
		<link rel="pingback" href="<?php echo esc_url( get_bloginfo( 'pingback_url' ) ); ?>">
	<?php endif;
}
endif;
add_action( 'darkmag_action_head', 'darkmag_head', 10 );

if ( ! function_exists( 'darkmag_page_start' ) ) :
	/**
	 * Add Skip to content.
	 *
	 * @since 1.0.0
	 */
	function darkmag_page_start() {
	?><div id="page" class="site"><a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'darkmag' ); ?></a><?php
	}
endif;

add_action( 'darkmag_action_before', 'darkmag_page_start', 10 );

if ( ! function_exists( 'darkmag_header_start' ) ) :
	/**
	 * Header Start.
	 *
	 * @since 1.0.0
	 */
	function darkmag_header_start() { ?>
    
        <div id="top-bar" class="top-bar-widgets col-2">
            <div class="wrapper">
                <div class="widget current-date">
                    <?php echo date('jS F Y, l'); ?>
                </div><!-- .current-date -->

                <div class="widget widget_social_icons">
                   <?php darkmag_render_social_links(); ?>
                </div><!-- .widget_social_icons -->
            </div><!-- .wrapper -->
        </div><!-- #top-bar -->

		<header id="masthead" class="site-header" role="banner"><?php
	}
endif;
add_action( 'darkmag_action_before_header', 'darkmag_header_start' );

if ( ! function_exists( 'darkmag_header_end' ) ) :
	/**
	 * Header Start.
	 *
	 * @since 1.0.0
	 */
	function darkmag_header_end() {

		?></header> <!-- header ends here --><?php
	}
endif;
add_action( 'darkmag_action_header', 'darkmag_header_end', 15 );

if ( ! function_exists( 'darkmag_content_start' ) ) :
	/**
	 * Header End.
	 *
	 * @since 1.0.0
	 */
	function darkmag_content_start() { 
	?>
	<div id="content" class="site-content">
	<?php 

	}
endif;

add_action( 'darkmag_action_before_content', 'darkmag_content_start', 10 );

if ( ! function_exists( 'darkmag_footer_start' ) ) :
	/**
	 * Footer Start.
	 *
	 * @since 1.0.0
	 */
	function darkmag_footer_start() {
		if( !(is_home() || is_front_page()) ){
			echo '</div>';
		} ?>
		</div>
		<footer id="colophon" class="site-footer" role="contentinfo">
			<?php
	}
endif;
add_action( 'darkmag_action_before_footer', 'darkmag_footer_start' );

if ( ! function_exists( 'darkmag_footer_end' ) ) :
	/**
	 * Footer End.
	 *
	 * @since 1.0.0
	 */
	function darkmag_footer_end() {?>
		</footer><div class="backtotop"><i class="fas fa-caret-up"></i></div><?php
	}
endif;
add_action( 'darkmag_action_after_footer', 'darkmag_footer_end' );
