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

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

add_action( 'online_news_action_doctype', 'online_news_doctype', 10 );


if ( ! function_exists( 'online_news_head' ) ) :
    /**
     * Header Codes.
     *
     * @since 1.0.0
     */
    function online_news_head() {
        ?>
        <meta charset="<?php bloginfo( 'charset' ); ?>">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="profile" href="https://gmpg.org/xfn/11">
        <?php
    }
endif;
add_action( 'online_news_action_head', 'online_news_head', 10 );

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

    add_action( 'online_news_action_before', 'online_news_skip_to_content', 15 );


    if ( ! function_exists( 'online_news_header_start' ) ) :
    /**
     * Header Start.
     *
     * @since 1.0.0
     */
    function online_news_header_start() {
    $header_class = 'site-header';
    if ( is_front_page() && is_home() ) {
        $header_class ='site-header';
    } elseif ( is_front_page() ) {
        $header_class ='site-header header-main';
    } elseif ( is_home() ) {
        $header_class ='site-header';
    } else{
        $header_class ='site-header';
    }

    ?><header id="masthead" class="<?php echo esc_attr($header_class);?>" role="banner"><?php
        }
        endif;
        add_action( 'online_news_action_before_header', 'online_news_header_start' );

        if ( ! function_exists( 'online_news_header_end' ) ) :
        /**
         * Header End.
         *
         * @since 1.0.0
         */
        function online_news_header_end() {
        ?></header><!-- #masthead --><?php
}
endif;
add_action( 'online_news_action_after_header', 'online_news_header_end' );

if ( ! function_exists( 'online_news_page_end' ) ) :
/**
 * Page End.
 *
 * @since 1.0.0
 */
function online_news_page_end() {
?></div><!-- #page --><?php
}
endif;

add_action( 'online_news_action_after', 'online_news_page_end' );

if ( ! function_exists( 'online_news_content_start' ) ) :
/**
 * Header End.
 *
 * @since 1.0.0
 */
function online_news_content_start() {
if ( is_front_page() ) {
    do_action( 'online_news_slider' );
}
?>
<div id="content" class="site-content"><div class="container"><?php
        if( !is_home() || !is_front_page() ){
            echo '<div class= "row">';
        }
        }
        endif;

        add_action( 'online_news_action_before_content', 'online_news_content_start' );

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

    if ( ! function_exists( 'online_news_footer_end' ) ) :
    /**
     * Footer End.
     *
     * @since 1.0.0
     */
    function online_news_footer_end() {?>
</footer><?php
}
endif;
add_action( 'online_news_action_after_footer', 'online_news_footer_end' );