Current File : /home/mdkeenpw/www/wp-content/themes/globallogistics/index.php
<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: //codex.wordpress.org/Template_Hierarchy
 *
 * @package GLOBALLOGISTICS
 * @since GLOBALLOGISTICS 1.0
 */

$globallogistics_template = apply_filters( 'globallogistics_filter_get_template_part', globallogistics_blog_archive_get_template() );

if ( ! empty( $globallogistics_template ) && 'index' != $globallogistics_template ) {

	get_template_part( $globallogistics_template );

} else {

	globallogistics_storage_set( 'blog_archive', true );

	get_header();

	if ( have_posts() ) {

		// Query params
		$globallogistics_stickies   = is_home()
								|| ( in_array( globallogistics_get_theme_option( 'post_type' ), array( '', 'post' ) )
									&& (int) globallogistics_get_theme_option( 'parent_cat' ) == 0
									)
										? get_option( 'sticky_posts' )
										: false;
		$globallogistics_post_type  = globallogistics_get_theme_option( 'post_type' );
		$globallogistics_args       = array(
								'blog_style'     => globallogistics_get_theme_option( 'blog_style' ),
								'post_type'      => $globallogistics_post_type,
								'taxonomy'       => globallogistics_get_post_type_taxonomy( $globallogistics_post_type ),
								'parent_cat'     => globallogistics_get_theme_option( 'parent_cat' ),
								'posts_per_page' => globallogistics_get_theme_option( 'posts_per_page' ),
								'sticky'         => globallogistics_get_theme_option( 'sticky_style' ) == 'columns'
															&& is_array( $globallogistics_stickies )
															&& count( $globallogistics_stickies ) > 0
															&& get_query_var( 'paged' ) < 1
								);

		globallogistics_blog_archive_start();

		do_action( 'globallogistics_action_blog_archive_start' );

		if ( is_author() ) {
			do_action( 'globallogistics_action_before_page_author' );
			get_template_part( apply_filters( 'globallogistics_filter_get_template_part', 'templates/author-page' ) );
			do_action( 'globallogistics_action_after_page_author' );
		}

		if ( globallogistics_get_theme_option( 'show_filters' ) ) {
			do_action( 'globallogistics_action_before_page_filters' );
			globallogistics_show_filters( $globallogistics_args );
			do_action( 'globallogistics_action_after_page_filters' );
		} else {
			do_action( 'globallogistics_action_before_page_posts' );
			globallogistics_show_posts( array_merge( $globallogistics_args, array( 'cat' => $globallogistics_args['parent_cat'] ) ) );
			do_action( 'globallogistics_action_after_page_posts' );
		}

		do_action( 'globallogistics_action_blog_archive_end' );

		globallogistics_blog_archive_end();

	} else {

		if ( is_search() ) {
			get_template_part( apply_filters( 'globallogistics_filter_get_template_part', 'templates/content', 'none-search' ), 'none-search' );
		} else {
			get_template_part( apply_filters( 'globallogistics_filter_get_template_part', 'templates/content', 'none-archive' ), 'none-archive' );
		}
	}

	get_footer();
}