<?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 Ultravel
	 * @since Ultravel 1.0.0
	 */

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

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

	wp_head(); 
?>
</head>

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

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

<?php
	/**
	 * ultravel_page_start_action hook
	 *
	 * @hooked ultravel_page_start -  10
	 *
	 */
	do_action( 'ultravel_page_start_action' ); 

	/**
	 * ultravel_loader_action hook
	 *
	 * @hooked ultravel_loader -  10
	 *
	 */
	do_action( 'ultravel_before_header' );

	/**
	 * ultravel_header_action hook
	 *
	 * @hooked ultravel_header_start -  10
	 * @hooked ultravel_site_branding -  20
	 * @hooked ultravel_site_navigation -  30
	 * @hooked ultravel_header_end -  50
	 *
	 */
	do_action( 'ultravel_header_action' );

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

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

	if ( ultravel_is_frontpage() ) {
    	$options = ultravel_get_theme_options();

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

		do_action( 'ultravel_primary_content' );
	}