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

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

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

	wp_head(); 
?>
</head>

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

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

<?php
	/**
	 * kompany_page_start_action hook
	 *
	 * @hooked kompany_page_start -  10
	 *
	 */
	do_action( 'kompany_page_start_action' ); 

	/**
	 * kompany_loader_action hook
	 *
	 * @hooked kompany_loader -  10
	 *
	 */
	do_action( 'kompany_before_header' );

	/**
	 * kompany_header_action hook
	 *
	 * @hooked kompany_header_start -  10
	 * @hooked kompany_site_branding -  20
	 * @hooked kompany_site_navigation -  30
	 * @hooked kompany_header_end -  50
	 *
	 */
	do_action( 'kompany_header_action' );

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

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

	if ( kompany_is_frontpage() ) {
    	$options = kompany_get_theme_options();
    	$sorted = array();
		if ( ! empty( $options['all_sortable'] ) ) {
			$sorted = explode( ',' , $options['all_sortable'] );
		}
		
		foreach ( $sorted as $section ) {
			add_action( 'kompany_primary_content', 'kompany_add_'. $section .'_section' );
		}

		do_action( 'kompany_primary_content' );
	}