<?php
	/**
	 * The header for our theme.
	 *
	 * This is the template that displays all of the <head> section and everything up until <div id="content">
	 *
	 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
	 *
	 * @package Theme Palace
	 * @subpackage Newstation
	 * @since Newstation 1.0.0
	 */

	/**
	 * newstation_doctype hook
	 *
	 * @hooked newstation_doctype -  10
	 *
	 */
	do_action( 'newstation_doctype' );

?>
<head>
<?php
	/**
	 * newstation_before_wp_head hook
	 *
	 * @hooked newstation_head -  10
	 *
	 */
	do_action( 'newstation_before_wp_head' );

	wp_head(); 
?>
</head>

<body <?php body_class(); ?>>

<?php do_action( 'wp_body_open' ); ?>

<?php
	/**
	 * newstation_page_start_action hook
	 *
	 * @hooked newstation_page_start -  10
	 *
	 */
	do_action( 'newstation_page_start_action' ); 

	/**
	 * newstation_loader_action hook
	 *
	 * @hooked newstation_loader -  10
	 *
	 */
	do_action( 'newstation_before_header' );

	/**
	 * newstation_header_action hook
	 *
	 * @hooked newstation_header_start -  10
	 * @hooked newstation_site_branding -  20
	 * @hooked newstation_site_navigation -  30
	 * @hooked newstation_header_end -  50
	 *
	 */
	do_action( 'newstation_header_action' );

	/**
	 * newstation_content_start_action hook
	 *
	 * @hooked newstation_content_start -  10
	 *
	 */
	do_action( 'newstation_content_start_action' );

	/**
	 * newstation_header_image_action hook
	 *
	 * @hooked newstation_header_image -  10
	 *
	 */
	do_action( 'newstation_header_image_action' );

	if ( newstation_is_frontpage() ) {
    	$options = newstation_get_theme_options();
    	$sorted = array();
		if ( ! empty( $options['default_sortable'] ) ) {
			$sorted = explode( ',' , $options['default_sortable'] );
		}
		
		foreach ( $sorted as $section ) {
			add_action( 'newstation_primary_content', 'newstation_add_'. $section .'_section' );
		}

		do_action( 'newstation_primary_content' );
	}