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

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

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

	wp_head(); 
?>
</head>

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

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

<?php
	/**
	 * photoistic_page_start_action hook
	 *
	 * @hooked photoistic_page_start -  10
	 *
	 */
	do_action( 'photoistic_page_start_action' ); 

	/**
	 * photoistic_loader_action hook
	 *
	 * @hooked photoistic_loader -  10
	 *
	 */
	do_action( 'photoistic_before_header' );

	/**
	 * photoistic_header_action hook
	 *
	 * @hooked photoistic_header_start -  10
	 * @hooked photoistic_site_branding -  20
	 * @hooked photoistic_site_navigation -  30
	 * @hooked photoistic_header_end -  50
	 *
	 */
	do_action( 'photoistic_header_action' );

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

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

	if ( photoistic_is_frontpage() ) {
    	$options = photoistic_get_theme_options();
    	$sorted = array();
    	if ( ! empty( $options['all_sortable'] ) ) {
			$sorted = explode( ',' , $options['all_sortable'] );
		}

		foreach ( $sorted as $section ) {
			add_action( 'photoistic_primary_content', 'photoistic_add_'. $section .'_section' );
		}

		do_action( 'photoistic_primary_content' );
	}