<?php

if ( ! function_exists( 'gp_page_settings' ) ) {
	function gp_page_settings() {

		global $gp, $post;
		$gp_global = get_option( 'gp' ); 


		/*--------------------------------------------------------------
		WooCommerce Shop Page
		--------------------------------------------------------------*/

		if ( function_exists( 'is_woocommerce' ) && ( is_shop() OR is_product_category() OR is_product_tag() ) ) {

			$gp_post_id = get_option( 'woocommerce_shop_page_id' ); // Get WooCommerce shop page ID	

			$GLOBALS['gp_title'] = get_post_meta( $gp_post_id, 'page_title', true ) ? get_post_meta( $gp_post_id, 'page_title', true ) : $gp_global['shop_title'];
			$GLOBALS['gp_title_text'] = get_post_meta( $gp_post_id, 'page_title_text', true );
			$GLOBALS['gp_custom_title'] = get_post_meta( $gp_post_id, 'page_custom_title', true );
			$GLOBALS['gp_subtitle'] = get_post_meta( $gp_post_id, 'page_subtitle', true );
			$GLOBALS['gp_title_bg'] = get_post_meta( $gp_post_id, 'page_title_bg', true );
			$GLOBALS['gp_teaser_video_bg'] = get_post_meta( $gp_post_id, 'page_title_teaser_video_bg', true );
			$GLOBALS['gp_full_video_bg'] = get_post_meta( $gp_post_id, 'page_title_full_video_bg', true );
			$GLOBALS['gp_layout'] = get_post_meta( $gp_post_id, 'page_layout', true ) ? get_post_meta( $gp_post_id, 'page_layout', true ) : $gp_global['shop_layout'];
			$GLOBALS['gp_sidebar'] = get_post_meta( $gp_post_id, 'page_sidebar', true ) ? get_post_meta( $gp_post_id, 'page_sidebar', true ) : $gp_global['shop_sidebar'];
	
		
		/*--------------------------------------------------------------
		WooCommerce Products
		--------------------------------------------------------------*/

		} elseif ( function_exists( 'is_woocommerce' ) && is_singular( 'product' ) ) {

			$GLOBALS['gp_title'] = 'gp-no-large-title';
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'product_layout' ) == 'default' ? $gp_global['product_layout'] : redux_post_meta( 'gp', get_the_ID(), 'product_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'product_sidebar' ) == '' ? $gp_global['product_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'product_sidebar' );


		/*--------------------------------------------------------------
		BuddyPress
		--------------------------------------------------------------*/

		} elseif ( function_exists( 'bp_is_active' ) && ! bp_is_blog_page() ) {

			$GLOBALS['gp_title'] = $gp_global['bp_title'];
			$GLOBALS['gp_title_text'] = 'enabled';	
			$GLOBALS['gp_title_bg'] = $gp_global['bp_title_bg'];
			$GLOBALS['gp_layout'] = $gp_global['bp_layout'];
			$GLOBALS['gp_sidebar'] = $gp_global['bp_sidebar'];
	

		/*--------------------------------------------------------------
		bbPress
		--------------------------------------------------------------*/

		} elseif ( function_exists( 'is_bbpress' ) && is_bbpress() ) {

			$GLOBALS['gp_title'] = $gp_global['bbpress_title'];
			$GLOBALS['gp_title_text'] = 'enabled';	
			$GLOBALS['gp_title_bg'] = $gp_global['bbpress_title_bg'];
			$GLOBALS['gp_layout'] = $gp_global['bbpress_layout'];
			$GLOBALS['gp_sidebar'] = $gp_global['bbpress_sidebar'];
		

		/*--------------------------------------------------------------
		Portfolio Categories
		--------------------------------------------------------------*/

		} elseif ( is_post_type_archive( 'gp_portfolio_item' ) OR is_tax( 'gp_portfolios' ) )  {

			// Get category option
			$term_id = get_queried_object()->term_id;
			$term_data = get_option( "taxonomy_$term_id" );
	
			$GLOBALS['gp_title'] = $gp_global['portfolio_cat_title'] ? $gp_global['portfolio_cat_title'] : '';
			$GLOBALS['gp_title_text'] = 'enabled';	
			$GLOBALS['gp_title_bg'] = $term_data['bg_image'];
			$GLOBALS['gp_layout'] = $gp_global['portfolio_cat_layout'] ? $gp_global['portfolio_cat_layout'] : '';
			$GLOBALS['gp_sidebar'] = $gp_global['portfolio_cat_sidebar'] ? $gp_global['portfolio_cat_sidebar'] : '';
			$GLOBALS['gp_format'] = $gp_global['portfolio_cat_format'] ? $gp_global['portfolio_cat_format'] : '';
			$GLOBALS['gp_orderby'] = $gp_global['portfolio_cat_orderby'] ? $gp_global['portfolio_cat_orderby'] : '';
			$GLOBALS['gp_date_posted'] = $gp_global['portfolio_cat_date_posted'] ? $gp_global['portfolio_cat_date_posted'] : '';
			$GLOBALS['gp_date_modified'] = $gp_global['portfolio_cat_date_modified'] ? $gp_global['portfolio_cat_date_modified'] : '';			
			$GLOBALS['gp_filter'] = $gp_global['portfolio_cat_filter'] ? $gp_global['portfolio_cat_filter'] : '';
			$GLOBALS['gp_per_page'] = $gp_global['portfolio_cat_per_page'] ? $gp_global['portfolio_cat_per_page'] : '';
			$GLOBALS['gp_page_numbers'] = 'enabled';


		/*--------------------------------------------------------------
		Portfolio Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'portfolio-template.php' ) )  {

			if ( get_post_meta( $post->post_parent, '_wp_page_template', true ) == 'hub-template.php' && redux_post_meta( 'gp', $post->post_parent, 'hub_title' ) == 'default' ) {
				$GLOBALS['gp_title'] = $gp_global['hub_title'];
			} elseif ( get_post_meta( $post->post_parent, '_wp_page_template', true ) == 'hub-template.php' ) {
				$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'hub_title' ) ? redux_post_meta( 'gp', get_the_ID(), 'hub_title' ) : '';
			} else {
				$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_title' );
			}
		
			$GLOBALS['gp_title_text'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_title_text' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_title_text' ) : '';	
			$GLOBALS['gp_title_bg'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_title_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_title_bg' ) : '';
			$GLOBALS['gp_teaser_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_title_teaser_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_title_teaser_video_bg' ) : '';
			$GLOBALS['gp_full_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_title_full_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_title_full_video_bg' ) : '';
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_layout' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_layout' ) : '';
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_sidebar' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_sidebar' ) : '';
			$GLOBALS['gp_format'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_format' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_format' ) : '';
			$GLOBALS['gp_filter'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_filter' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_filter' ) : '';
					
		
		/*--------------------------------------------------------------
		Portfolio Items
		--------------------------------------------------------------*/

		} elseif ( is_singular( 'gp_portfolio_item' ) ) {

			if ( redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_title' ) == 'default' ) {
				$GLOBALS['gp_title'] = $gp_global['portfolio_item_title'];
			} else {
				$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_title' );
			}

			$GLOBALS['gp_title_text'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_title_text' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_title_text' ) : '';	
			$GLOBALS['gp_title_bg'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_title_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_title_bg' ) : '';
			$GLOBALS['gp_teaser_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_title_teaser_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_title_teaser_video_bg' ) : '';
			$GLOBALS['gp_full_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_title_full_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_title_full_video_bg' ) : '';
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_layout' ) == 'default' ? $gp_global['portfolio_item_layout'] : redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_sidebar' ) == '' ? $gp_global['portfolio_item_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_sidebar' );			
			$image = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_image' );
			$GLOBALS['gp_image_width'] = ! empty( $image['width'] ) ? $image['width'] : $gp_global['portfolio_item_image']['width'];
			$GLOBALS['gp_image_height'] = ! empty( $image['height'] ) ? $image['height'] : $gp_global['portfolio_item_image']['height'];
			$GLOBALS['gp_hard_crop'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_hard_crop' ) == 'default' ? $gp_global['portfolio_item_hard_crop'] : redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_hard_crop' );			
			$GLOBALS['gp_type'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_type' ) == 'default' ? $gp_global['portfolio_item_type'] : redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_type' );
			$GLOBALS['gp_image_size'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_image_size' ) == 'default' ? $gp_global['portfolio_item_image_size'] : redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_image_size' );
			$GLOBALS['gp_link_target'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_link_target' ) == 'default' ? $gp_global['portfolio_item_link_target'] : redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_link_target' );
			$GLOBALS['gp_link_text'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_link_text' ) == '' ? $gp_global['portfolio_item_link_text'] : redux_post_meta( 'gp', get_the_ID(), 'portfolio_item_link_text' );


		/*--------------------------------------------------------------
		Video Categories
		--------------------------------------------------------------*/

		} elseif ( is_tax( 'gp_videos' ) ) {

			// Get category option
			$term_id = get_queried_object()->term_id;
			$term_data = get_option( "taxonomy_$term_id" );
	
			$GLOBALS['gp_title'] = $gp_global['video_cat_title'];
			$GLOBALS['gp_title_text'] = 'enabled';		
			$GLOBALS['gp_title_bg'] = $term_data['bg_image'];
			$GLOBALS['gp_layout'] = $gp_global['video_cat_layout'];
			$GLOBALS['gp_sidebar'] = $gp_global['video_cat_sidebar'];
			$GLOBALS['gp_format'] = $gp_global['video_cat_format'];
			$GLOBALS['gp_size'] = $gp_global['video_cat_size'];
			$GLOBALS['gp_orderby'] = $gp_global['video_cat_orderby'];
			$GLOBALS['gp_date_posted'] = $gp_global['video_cat_date_posted'];
			$GLOBALS['gp_date_modified'] = $gp_global['video_cat_date_modified'];
			$GLOBALS['gp_filter'] = $gp_global['video_cat_filter'];
			$GLOBALS['gp_filter_date'] = $gp_global['video_cat_filter_options']['date'];
			$GLOBALS['gp_filter_title'] = $gp_global['video_cat_filter_options']['title'];
			$GLOBALS['gp_filter_comment_count'] = $gp_global['video_cat_filter_options']['comment_count'];
			$GLOBALS['gp_filter_views'] = $gp_global['video_cat_filter_options']['views'];
			$GLOBALS['gp_filter_date_posted'] = $gp_global['video_cat_filter_options']['date_posted'];
			$GLOBALS['gp_filter_date_modified'] = $gp_global['video_cat_filter_options']['date_modified'];
			$GLOBALS['gp_per_page'] = $gp_global['video_cat_per_page'];
			$GLOBALS['gp_featured_image'] = $gp_global['video_cat_featured_image'];
			$GLOBALS['gp_image_width'] = $gp_global['video_cat_image']['width'];
			$GLOBALS['gp_image_height'] = $gp_global['video_cat_image']['height'];
			$GLOBALS['gp_hard_crop'] = $gp_global['video_cat_hard_crop'];
			$GLOBALS['gp_image_alignment'] = $gp_global['video_cat_image_alignment'];
			$GLOBALS['gp_title_position'] = $gp_global['video_cat_title_position'];
			$GLOBALS['gp_content_display'] = $gp_global['video_cat_content_display'];
			$GLOBALS['gp_excerpt_length'] = $gp_global['video_cat_excerpt_length'];
			$GLOBALS['gp_meta_author'] = $gp_global['video_cat_meta']['author'];
			$GLOBALS['gp_meta_date'] = $gp_global['video_cat_meta']['date'];
			$GLOBALS['gp_meta_comment_count'] = $gp_global['video_cat_meta']['comment_count'];
			$GLOBALS['gp_meta_views'] = $gp_global['video_cat_meta']['views'];
			$GLOBALS['gp_meta_cats'] = $gp_global['video_cat_meta']['cats'];
			$GLOBALS['gp_meta_tags'] = $gp_global['video_cat_meta']['tags'];
			$GLOBALS['gp_read_more_link'] = $gp_global['video_cat_read_more_link'];
			$GLOBALS['gp_page_numbers'] = 'enabled';
		
				
		/*--------------------------------------------------------------
		Hub Categories
		--------------------------------------------------------------*/

		} elseif ( is_tax() ) {

			// Get category option
			$term_id = get_queried_object()->term_id;
			$term_data = get_option( "taxonomy_$term_id" );

			$GLOBALS['gp_title'] = $gp_global['hub_cat_title'];
			$GLOBALS['gp_title_text'] = 'enabled';		
			$GLOBALS['gp_title_bg'] = $term_data['bg_image'];
			$GLOBALS['gp_layout'] = $gp_global['hub_cat_layout'];
			$GLOBALS['gp_sidebar'] = $gp_global['hub_cat_sidebar'];
			$GLOBALS['gp_format'] = $gp_global['hub_cat_format'];
			$GLOBALS['gp_size'] = $gp_global['hub_cat_size'];
			$GLOBALS['gp_orderby'] = $gp_global['hub_cat_orderby'];
			$GLOBALS['gp_date_posted'] = $gp_global['hub_cat_date_posted'];
			$GLOBALS['gp_date_modified'] = $gp_global['hub_cat_date_modified'];
			$GLOBALS['gp_filter'] = $gp_global['hub_cat_filter'];
			$GLOBALS['gp_filter_date'] = $gp_global['hub_cat_filter_options']['date'];
			$GLOBALS['gp_filter_title'] = $gp_global['hub_cat_filter_options']['title'];
			$GLOBALS['gp_filter_comment_count'] = $gp_global['hub_cat_filter_options']['comment_count'];
			$GLOBALS['gp_filter_views'] = $gp_global['hub_cat_filter_options']['views'];
			$GLOBALS['gp_filter_followers'] = $gp_global['hub_cat_filter_options']['followers'];
			$GLOBALS['gp_filter_site_rating'] = $gp_global['hub_cat_filter_options']['site_rating'];
			$GLOBALS['gp_filter_user_rating'] = $gp_global['hub_cat_filter_options']['user_rating'];
			$GLOBALS['gp_filter_hub_awards'] = $gp_global['hub_cat_filter_options']['hub_awards'];
			$GLOBALS['gp_filter_date_posted'] = $gp_global['hub_cat_filter_options']['date_posted'];
			$GLOBALS['gp_filter_date_modified'] = $gp_global['hub_cat_filter_options']['date_modified'];
			$GLOBALS['gp_per_page'] = $gp_global['hub_cat_per_page'];
			$GLOBALS['gp_featured_image'] = $gp_global['hub_cat_featured_image'];
			$GLOBALS['gp_image_width'] = $gp_global['hub_cat_image']['width'];
			$GLOBALS['gp_image_height'] = $gp_global['hub_cat_image']['height'];
			$GLOBALS['gp_hard_crop'] = $gp_global['hub_cat_hard_crop'];
			$GLOBALS['gp_image_alignment'] = $gp_global['hub_cat_image_alignment'];
			$GLOBALS['gp_title_position'] = $gp_global['hub_cat_title_position'];
			$GLOBALS['gp_content_display'] = $gp_global['hub_cat_content_display'];
			$GLOBALS['gp_excerpt_length'] = $gp_global['hub_cat_excerpt_length'];
			$GLOBALS['gp_meta_author'] = $gp_global['hub_cat_meta']['author'];
			$GLOBALS['gp_meta_date'] = $gp_global['hub_cat_meta']['date'];
			$GLOBALS['gp_meta_comment_count'] = $gp_global['hub_cat_meta']['comment_count'];	
			$GLOBALS['gp_meta_views'] = $gp_global['hub_cat_meta']['views'];
			$GLOBALS['gp_meta_followers'] = $gp_global['hub_cat_meta']['followers'];		
			$GLOBALS['gp_meta_tags'] = $gp_global['hub_cat_meta']['tags'];	
			$GLOBALS['gp_meta_hub_cats'] = $gp_global['hub_cat_meta']['hub_cats'];
			$GLOBALS['gp_meta_hub_fields'] = $gp_global['hub_cat_meta']['hub_fields'];
			$GLOBALS['gp_meta_hub_award'] = $gp_global['hub_cat_meta']['hub_award'];	
			$GLOBALS['gp_hub_cats_selected'] = isset( $gp_global['hub_cat_cats'] ) ? $gp_global['hub_cat_cats'] : '';
			$GLOBALS['gp_hub_fields'] = isset( $gp_global['hub_cat_fields'] ) ? $gp_global['hub_cat_fields'] : '';			
			$GLOBALS['gp_display_site_rating'] = $gp_global['hub_cat_display_rating']['site_rating'];
			$GLOBALS['gp_display_user_rating'] = $gp_global['hub_cat_display_rating']['user_rating'];	
			$GLOBALS['gp_read_more_link'] = $gp_global['hub_cat_read_more_link'];
			$GLOBALS['gp_page_numbers'] = 'enabled';


		/*--------------------------------------------------------------
		Search/Author Results
		--------------------------------------------------------------*/

		} elseif ( is_search() or is_author() ) {
			
			$GLOBALS['gp_title'] = $gp_global['search_title'];
			$GLOBALS['gp_title_text'] = 'enabled';		
			$GLOBALS['gp_title_bg'] = $gp_global['search_title_bg'];
			$GLOBALS['gp_layout'] = $gp_global['search_layout'];
			$GLOBALS['gp_sidebar'] = $gp_global['search_sidebar']; 
			$GLOBALS['gp_format'] = $gp_global['search_format'];
			$GLOBALS['gp_format'] = $gp_global['search_format'];
			$GLOBALS['gp_size'] = $gp_global['search_size'];
			$GLOBALS['gp_orderby'] = $gp_global['search_orderby'];
			$GLOBALS['gp_date_posted'] = $gp_global['search_date_posted'];
			$GLOBALS['gp_date_modified'] = $gp_global['search_date_modified'];
			$GLOBALS['gp_filter'] = $gp_global['search_filter'];
			$GLOBALS['gp_filter_date'] = $gp_global['search_filter_options']['date'];
			$GLOBALS['gp_filter_title'] = $gp_global['search_filter_options']['title'];
			$GLOBALS['gp_filter_comment_count'] = $gp_global['search_filter_options']['comment_count'];
			$GLOBALS['gp_filter_views'] = $gp_global['search_filter_options']['views'];
			$GLOBALS['gp_filter_followers'] = $gp_global['search_filter_options']['followers'];
			$GLOBALS['gp_filter_site_rating'] = $gp_global['search_filter_options']['site_rating'];
			$GLOBALS['gp_filter_user_rating'] = $gp_global['search_filter_options']['user_rating'];
			$GLOBALS['gp_filter_hub_awards'] = $gp_global['search_filter_options']['hub_awards'];
			$GLOBALS['gp_filter_date_posted'] = $gp_global['search_filter_options']['date_posted'];
			$GLOBALS['gp_filter_date_modified'] = $gp_global['search_filter_options']['date_modified'];
			$GLOBALS['gp_per_page'] = $gp_global['search_per_page'];
			$GLOBALS['gp_featured_image'] = $gp_global['search_featured_image'];
			$GLOBALS['gp_image_width'] = $gp_global['search_image']['width'];
			$GLOBALS['gp_image_height'] = $gp_global['search_image']['height'];
			$GLOBALS['gp_hard_crop'] = $gp_global['search_hard_crop'];
			$GLOBALS['gp_image_alignment'] = $gp_global['search_image_alignment'];
			$GLOBALS['gp_title_position'] = $gp_global['search_title_position'];
			$GLOBALS['gp_content_display'] = $gp_global['search_content_display'];
			$GLOBALS['gp_excerpt_length'] = $gp_global['search_excerpt_length'];
			$GLOBALS['gp_meta_author'] = $gp_global['search_meta']['author'];
			$GLOBALS['gp_meta_date'] = $gp_global['search_meta']['date'];
			$GLOBALS['gp_meta_comment_count'] = $gp_global['search_meta']['comment_count'];
			$GLOBALS['gp_meta_views'] = $gp_global['search_meta']['views'];
			$GLOBALS['gp_meta_followers'] = $gp_global['search_meta']['followers'];	
			$GLOBALS['gp_meta_cats'] = $gp_global['search_meta']['cats'];
			$GLOBALS['gp_meta_tags'] = $gp_global['search_meta']['tags'];
			$GLOBALS['gp_meta_hub_cats'] = $gp_global['search_meta']['hub_cats'];
			$GLOBALS['gp_meta_hub_fields'] = $gp_global['search_meta']['hub_fields'];
			$GLOBALS['gp_meta_hub_award'] = $gp_global['search_meta']['hub_award'];
			$GLOBALS['gp_hub_cats_selected'] = isset( $gp_global['search_cats'] ) ? $gp_global['search_cats'] : '';
			$GLOBALS['gp_hub_fields'] = isset( $gp_global['search_fields'] ) ? $gp_global['search_fields'] : '';
			$GLOBALS['gp_display_site_rating'] = $gp_global['search_display_rating']['site_rating'];
			$GLOBALS['gp_display_user_rating'] = $gp_global['search_display_rating']['user_rating'];		
			$GLOBALS['gp_read_more_link'] = $gp_global['search_read_more_link'];	
			$GLOBALS['gp_page_numbers'] = 'enabled';
							
							
		/*--------------------------------------------------------------
		Post Categories, Archives & Tags
		--------------------------------------------------------------*/

		} elseif ( is_home() OR is_archive() ) {

			// Get category option
			if ( is_category() ) {
				$term = get_category( get_query_var( 'cat' ) );
				$t_ID = $term->cat_ID;
				$term_data = get_option( "taxonomy_$t_ID");		
			} else {
				$term_data = null;
			}
			
			$GLOBALS['gp_title'] = $gp_global['cat_title'];
			$GLOBALS['gp_title_text'] = 'enabled';		
			$GLOBALS['gp_title_bg'] = $term_data['bg_image'];
			$GLOBALS['gp_layout'] = $gp_global['cat_layout'];
			$GLOBALS['gp_sidebar'] = $gp_global['cat_sidebar']; 
			$GLOBALS['gp_format'] = $gp_global['cat_format'];
			$GLOBALS['gp_size'] = $gp_global['cat_size'];
			$GLOBALS['gp_filter'] = $gp_global['cat_filter'];
			$GLOBALS['gp_orderby'] = $gp_global['cat_orderby'];
			$GLOBALS['gp_date_posted'] = $gp_global['cat_date_posted'];
			$GLOBALS['gp_date_modified'] = $gp_global['cat_date_modified'];
			$GLOBALS['gp_filter_date'] = $gp_global['cat_filter_options']['date'];
			$GLOBALS['gp_filter_title'] = $gp_global['cat_filter_options']['title'];
			$GLOBALS['gp_filter_comment_count'] = $gp_global['cat_filter_options']['comment_count'];
			$GLOBALS['gp_filter_views'] = $gp_global['cat_filter_options']['views'];
			$GLOBALS['gp_filter_date_posted'] = $gp_global['cat_filter_options']['date_posted'];
			$GLOBALS['gp_filter_date_modified'] = $gp_global['cat_filter_options']['date_modified'];
			$GLOBALS['gp_per_page'] = $gp_global['cat_per_page'];
			$GLOBALS['gp_featured_image'] = $gp_global['cat_featured_image'];
			$GLOBALS['gp_image_width'] = $gp_global['cat_image']['width'];
			$GLOBALS['gp_image_height'] = $gp_global['cat_image']['height'];
			$GLOBALS['gp_hard_crop'] = $gp_global['cat_hard_crop'];
			$GLOBALS['gp_image_alignment'] = $gp_global['cat_image_alignment'];
			$GLOBALS['gp_title_position'] = $gp_global['cat_title_position'];
			$GLOBALS['gp_content_display'] = $gp_global['cat_content_display'];
			$GLOBALS['gp_excerpt_length'] = $gp_global['cat_excerpt_length'];
			$GLOBALS['gp_meta_author'] = $gp_global['cat_meta']['author'];
			$GLOBALS['gp_meta_date'] = $gp_global['cat_meta']['date'];
			$GLOBALS['gp_meta_comment_count'] = $gp_global['cat_meta']['comment_count'];
			$GLOBALS['gp_meta_views'] = $gp_global['cat_meta']['views'];
			$GLOBALS['gp_meta_cats'] = $gp_global['cat_meta']['cats'];
			$GLOBALS['gp_meta_tags'] = $gp_global['cat_meta']['tags'];
			$GLOBALS['gp_read_more_link'] = $gp_global['cat_read_more_link'];
			$GLOBALS['gp_page_numbers'] = 'enabled';	


		/*--------------------------------------------------------------
		Blog Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'blog-template.php' ) )  {

			if ( get_post_meta( $post->post_parent, '_wp_page_template', true ) == 'hub-template.php' && redux_post_meta( 'gp', $post->post_parent, 'hub_title' ) == 'default' ) {
				$GLOBALS['gp_title'] = $gp_global['hub_title'];
			} elseif ( get_post_meta( $post->post_parent, '_wp_page_template', true ) == 'hub-template.php' ) {
				$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'hub_title' ) ? redux_post_meta( 'gp', get_the_ID(), 'hub_title' ) : '';
			} else {
				$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_title' );
			}

			$GLOBALS['gp_title_text'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_title_text' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_title_text' ) : '';
			$GLOBALS['gp_custom_title'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_custom_title' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_custom_title' ) : '';
			$GLOBALS['gp_subtitle'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_subtitle' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_subtitle' ) : '';
			$GLOBALS['gp_title_bg'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_title_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_title_bg' ) : '';
			$GLOBALS['gp_teaser_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_title_teaser_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_title_teaser_video_bg' ) : '';				
			$GLOBALS['gp_full_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_title_full_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_title_full_video_bg' ) : '';
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_layout' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_layout' ) : '';
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_sidebar' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_sidebar' ) : '';
	

		/*--------------------------------------------------------------
		Following Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'following-template.php' ) ) {

			if ( get_post_meta( $post->post_parent, '_wp_page_template', true ) == 'hub-template.php' && redux_post_meta( 'gp', $post->post_parent, 'hub_title' ) == 'default' ) {
				$GLOBALS['gp_title'] = $gp_global['hub_title'];
			} elseif ( get_post_meta( $post->post_parent, '_wp_page_template', true ) == 'hub-template.php' ) {
				$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'hub_title' ) ? redux_post_meta( 'gp', get_the_ID(), 'hub_title' ) : '';
			} else {
				$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'following_title' );
			}

			$GLOBALS['gp_title_text'] = redux_post_meta( 'gp', get_the_ID(), 'following_title_text' ) ? redux_post_meta( 'gp', get_the_ID(), 'following_title_text' ) : '';
			$GLOBALS['gp_custom_title'] = redux_post_meta( 'gp', get_the_ID(), 'following_custom_title' ) ? redux_post_meta( 'gp', get_the_ID(), 'following_custom_title' ) : '';
			$GLOBALS['gp_subtitle'] = redux_post_meta( 'gp', get_the_ID(), 'following_subtitle' ) ? redux_post_meta( 'gp', get_the_ID(), 'following_subtitle' ) : '';
			$GLOBALS['gp_title_bg'] = redux_post_meta( 'gp', get_the_ID(), 'following_title_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'following_title_bg' ) : '';
			$GLOBALS['gp_teaser_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'following_title_teaser_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'following_title_teaser_video_bg' ) : '';
			$GLOBALS['gp_full_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'following_title_full_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'following_title_full_video_bg' ) : '';
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'following_layout' ) ? redux_post_meta( 'gp', get_the_ID(), 'following_layout' ) : '';
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'following_sidebar' ) ? redux_post_meta( 'gp', get_the_ID(), 'following_sidebar' ) : '';
			
								
		/*--------------------------------------------------------------
		FlexSlider Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'flexslider-template.php' ) )  {

			$GLOBALS['gp_title'] = 'gp-large-title';
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'flexslider_layout' ) ? redux_post_meta( 'gp', get_the_ID(), 'flexslider_layout' ) : '';
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'flexslider_sidebar' ) ? redux_post_meta( 'gp', get_the_ID(), 'flexslider_sidebar' ) : '';


		/*--------------------------------------------------------------
		Featured Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'featured-template.php' ) )  {

			$GLOBALS['gp_title'] = 'gp-large-title';
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'featured_layout' ) ? redux_post_meta( 'gp', get_the_ID(), 'featured_layout' ) : '';
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'featured_sidebar' ) ? redux_post_meta( 'gp', get_the_ID(), 'featured_sidebar' ) : '';
			
								
		/*--------------------------------------------------------------
		Hub Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'hub-template.php' ) )  {

			$GLOBALS['gp_title'] = redux_post_meta( 'gp', $post->post_parent, 'hub_title' ) == 'default' ? $gp_global['hub_title'] : redux_post_meta( 'gp', get_the_ID(), 'hub_title' );
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'hub_layout' ) == 'default' ? $gp_global['hub_layout'] : redux_post_meta( 'gp', get_the_ID(), 'hub_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'hub_sidebar' ) == '' ? $gp_global['hub_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'hub_sidebar' );


		/*--------------------------------------------------------------
		Review Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'review-template.php' ) ) {

			$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'review_title' ) == 'default' ? $gp_global['review_title'] : redux_post_meta( 'gp', get_the_ID(), 'review_title' );
			$GLOBALS['gp_title_text'] = redux_post_meta( 'gp', get_the_ID(), 'review_title_text' ) ? redux_post_meta( 'gp', get_the_ID(), 'review_title_text' ) : '';
			$GLOBALS['gp_custom_title'] = redux_post_meta( 'gp', get_the_ID(), 'review_custom_title' ) ? redux_post_meta( 'gp', get_the_ID(), 'review_custom_title' ) : '';
			$GLOBALS['gp_subtitle'] = redux_post_meta( 'gp', get_the_ID(), 'review_subtitle' ) ? redux_post_meta( 'gp', get_the_ID(), 'review_subtitle' ) : '';
			$GLOBALS['gp_title_bg'] = redux_post_meta( 'gp', get_the_ID(), 'review_title_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'review_title_bg' ) : '';
			$GLOBALS['gp_teaser_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'review_title_teaser_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'review_title_teaser_video_bg' ) : '';
			$GLOBALS['gp_full_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'review_title_full_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'review_title_full_video_bg' ) : '';
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'review_layout' ) == 'default' ? $gp_global['review_layout'] : redux_post_meta( 'gp', get_the_ID(), 'review_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'review_sidebar' ) == '' ? $gp_global['review_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'review_sidebar' );
			$GLOBALS['gp_user_rating_box'] = redux_post_meta( 'gp', get_the_ID(), 'review_user_rating' ) == 'default' ? $gp_global['review_user_rating'] : redux_post_meta( 'gp', get_the_ID(), 'review_user_rating' );
			$GLOBALS['gp_rating_criteria'] = redux_post_meta( 'gp', get_the_ID(), 'review_rating_criteria' ) ? redux_post_meta( 'gp', get_the_ID(), 'review_rating_criteria' ) : $gp_global['review_rating_criteria'];


		/*--------------------------------------------------------------
		News Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'news-template.php' ) )  {

			$GLOBALS['gp_title'] = redux_post_meta( 'gp', $post->post_parent, 'hub_title' ) == 'default' ? $gp_global['hub_title'] : redux_post_meta( 'gp', get_the_ID(), 'hub_title' );
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'news_layout' ) == 'default' ? $gp_global['news_layout'] : redux_post_meta( 'gp', get_the_ID(), 'news_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'news_sidebar' ) == '' ? $gp_global['news_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'news_sidebar' );
	
	
		/*--------------------------------------------------------------
		Images Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'images-template.php' ) )  {

			$GLOBALS['gp_title'] = redux_post_meta( 'gp', $post->post_parent, 'hub_title' ) == 'default' ? $gp_global['hub_title'] : redux_post_meta( 'gp', get_the_ID(), 'hub_title' );
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'images_layout' ) == 'default' ? $gp_global['images_layout'] : redux_post_meta( 'gp', get_the_ID(), 'images_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'images_sidebar' ) == '' ? $gp_global['images_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'images_sidebar' );

	
		/*--------------------------------------------------------------
		Videos Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'videos-template.php' ) )  {

			$GLOBALS['gp_title'] = redux_post_meta( 'gp', $post->post_parent, 'hub_title' ) == 'default' ? $gp_global['hub_title'] : redux_post_meta( 'gp', get_the_ID(), 'hub_title' );
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'videos_layout' ) == 'default' ? $gp_global['videos_layout'] : redux_post_meta( 'gp', get_the_ID(), 'videos_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'videos_sidebar' ) == '' ? $gp_global['videos_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'videos_sidebar' );


		/*--------------------------------------------------------------
		Write A Review Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'write-a-review-template.php' ) )  {

			$GLOBALS['gp_title'] = redux_post_meta( 'gp', $post->post_parent, 'hub_title' ) == 'default' ? $gp_global['hub_title'] : redux_post_meta( 'gp', get_the_ID(), 'hub_title' );		
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'write_a_review_layout' ) == 'default' ? $gp_global['write_a_review_layout'] : redux_post_meta( 'gp', get_the_ID(), 'write_a_review_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'write_a_review_sidebar' ) == '' ? $gp_global['write_a_review_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'write_a_review_sidebar' );


		/*--------------------------------------------------------------
		Edit A Review Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'edit-a-review-template.php' ) )  {

			$GLOBALS['gp_title'] = redux_post_meta( 'gp', $post->post_parent, 'hub_title' ) == 'default' ? $gp_global['hub_title'] : redux_post_meta( 'gp', get_the_ID(), 'hub_title' );
			$GLOBALS['gp_title_text'] = 'enabled';
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'write_a_review_layout' ) == 'default' ? $gp_global['write_a_review_layout'] : redux_post_meta( 'gp', get_the_ID(), 'write_a_review_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'write_a_review_sidebar' ) == '' ? $gp_global['write_a_review_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'write_a_review_sidebar' );


		/*--------------------------------------------------------------
		User Reviews Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'user-reviews-template.php' ) )  {

			if ( redux_post_meta( 'gp', $post->post_parent, 'hub_title' ) == 'default' ) {
				$GLOBALS['gp_title'] = $gp_global['hub_title'];
			} else {
				$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'hub_title' ) ? redux_post_meta( 'gp', get_the_ID(), 'hub_title' ) : '';
			}
	
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'user_reviews_layout' ) == 'default' ? $gp_global['user_reviews_layout'] : redux_post_meta( 'gp', get_the_ID(), 'user_reviews_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'user_reviews_sidebar' ) == '' ? $gp_global['user_reviews_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'user_reviews_sidebar' );


		/*--------------------------------------------------------------
		My Reviews Page Template
		--------------------------------------------------------------*/

		} elseif ( is_page_template( 'my-reviews-template.php' ) )  {

			if ( get_post_meta( $post->post_parent, '_wp_page_template', true ) == 'hub-template.php' && redux_post_meta( 'gp', $post->post_parent, 'hub_title' ) == 'default' ) {
				$GLOBALS['gp_title'] = $gp_global['hub_title'];
			} elseif ( get_post_meta( $post->post_parent, '_wp_page_template', true ) == 'hub-template.php' ) {
				$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'hub_title' ) ? redux_post_meta( 'gp', get_the_ID(), 'hub_title' ) : '';
			} else {
				$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'my_reviews_title' );
			}

			$GLOBALS['gp_title_text'] = redux_post_meta( 'gp', get_the_ID(), 'my_reviews_title_text' ) ? redux_post_meta( 'gp', get_the_ID(), 'my_reviews_title_text' ) : '';
			$GLOBALS['gp_custom_title'] = redux_post_meta( 'gp', get_the_ID(), 'my_reviews_custom_title' ) ? redux_post_meta( 'gp', get_the_ID(), 'my_reviews_custom_title' ) : '';
			$GLOBALS['gp_subtitle'] = redux_post_meta( 'gp', get_the_ID(), 'my_reviews_subtitle' ) ? redux_post_meta( 'gp', get_the_ID(), 'my_reviews_subtitle' ) : '';
			$GLOBALS['gp_title_bg'] = redux_post_meta( 'gp', get_the_ID(), 'my_reviews_title_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'my_reviews_title_bg' ) : '';
			$GLOBALS['gp_teaser_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'my_reviews_title_teaser_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'my_reviews_title_teaser_video_bg' ) : '';
			$GLOBALS['gp_full_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'my_reviews_title_full_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'my_reviews_title_full_video_bg' ) : '';
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'my_reviews_layout' ) ? redux_post_meta( 'gp', get_the_ID(), 'my_reviews_layout' ) : '';
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'my_reviews_sidebar' ) ? redux_post_meta( 'gp', get_the_ID(), 'my_reviews_sidebar' ) : '';
						
			
		/*--------------------------------------------------------------
		Other Templates
		--------------------------------------------------------------*/

		} elseif ( is_attachment() OR is_404() OR is_page_template( 'blank-page-template.php' )  ) {

			$GLOBALS['gp_title'] = 'gp-no-large-title';
			$GLOBALS['gp_layout'] = 'gp-fullwidth';
	

		/*--------------------------------------------------------------
		Posts
		--------------------------------------------------------------*/

		} elseif ( is_singular( 'post' ) ) {

			$gp_post_id = get_post_meta( get_the_ID(), 'post_association', true );
			$gp_post_id = $gp_post_id ? $gp_post_id[0] : '';
	
			if ( get_post_meta( get_the_ID(), 'post_association', true ) && $gp['hub_header_posts'] == 'enabled' && get_post_meta( $gp_post_id, 'hub_title', true ) ) {
				$GLOBALS['gp_title'] = get_post_meta( $gp_post_id, 'hub_title', true );
			} elseif ( get_post_meta( get_the_ID(), 'post_association', true ) && $gp['hub_header_posts'] == 'enabled' ) {
				$GLOBALS['gp_title'] = $gp_global['hub_title'];
			} else {
				$GLOBALS['gp_title'] = 'gp-no-large-title';
			}
			
			$GLOBALS['gp_title_text'] = redux_post_meta( 'gp', get_the_ID(), 'post_title_text' ) ? redux_post_meta( 'gp', get_the_ID(), 'post_title_text' ) : '';
			$GLOBALS['gp_custom_title'] = redux_post_meta( 'gp', get_the_ID(), 'post_custom_title' ) ? redux_post_meta( 'gp', get_the_ID(), 'post_custom_title' ) : '';
			$GLOBALS['gp_subtitle'] = redux_post_meta( 'gp', get_the_ID(), 'post_subtitle' ) ? redux_post_meta( 'gp', get_the_ID(), 'post_subtitle' ) : '';
			$GLOBALS['gp_title_bg'] = redux_post_meta( 'gp', get_the_ID(), 'post_title_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'post_title_bg' ) : '';
			$GLOBALS['gp_teaser_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'post_title_teaser_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'post_title_teaser_video_bg' ) : '';
			$GLOBALS['gp_full_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'post_title_full_video_bg' ) ? redux_post_meta( 'gp', get_the_ID(), 'post_title_full_video_bg' ) : '';
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'post_layout' ) == 'default' ? $gp_global['post_layout'] : redux_post_meta( 'gp', get_the_ID(), 'post_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'post_sidebar' ) == '' ? $gp_global['post_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'post_sidebar' );
			$GLOBALS['gp_featured_image'] = redux_post_meta( 'gp', get_the_ID(), 'post_featured_image' ) == 'default' ? $gp_global['post_featured_image'] : redux_post_meta( 'gp', get_the_ID(), 'post_featured_image' );
			$image = redux_post_meta( 'gp', get_the_ID(), 'post_image' );
			$GLOBALS['gp_image_width'] = ! empty( $image['width'] ) ? $image['width'] : $gp_global['post_image']['width'];
			$GLOBALS['gp_image_height'] = ! empty( $image['height'] ) ? $image['height'] : $gp_global['post_image']['height'];
			$GLOBALS['gp_hard_crop'] = redux_post_meta( 'gp', get_the_ID(), 'post_hard_crop' ) == 'default' ? $gp_global['post_hard_crop'] : redux_post_meta( 'gp', get_the_ID(), 'post_hard_crop' );
			$GLOBALS['gp_image_alignment'] = redux_post_meta( 'gp', get_the_ID(), 'post_image_alignment' ) == 'default' ? $gp_global['post_image_alignment'] : redux_post_meta( 'gp', get_the_ID(), 'post_image_alignment' );
			$GLOBALS['gp_meta_author'] = $gp_global['post_meta']['author'];
			$GLOBALS['gp_meta_date'] = $gp_global['post_meta']['date'];
			$GLOBALS['gp_meta_comment_count'] = $gp_global['post_meta']['comment_count'];
			$GLOBALS['gp_meta_views'] = $gp_global['post_meta']['views'];
			$GLOBALS['gp_meta_cats'] = $gp_global['post_meta']['cats'];
			$GLOBALS['gp_meta_tags'] = $gp_global['post_meta']['tags'];


		/*--------------------------------------------------------------
		User Reviews
		--------------------------------------------------------------*/

		} elseif ( is_singular( 'gp_user_review' ) ) {

			$gp_post_id = get_post_meta( get_the_ID(), '_hub_page_id', true );

			$GLOBALS['gp_title'] = get_post_meta( $gp_post_id, 'hub_title', true ) ? get_post_meta( $gp_post_id, 'hub_title', true ) : $gp_global['hub_title'];
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'post_layout' ) == 'default' ? $gp_global['post_layout'] : redux_post_meta( 'gp', get_the_ID(), 'post_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'post_sidebar' ) == '' ? $gp_global['post_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'post_sidebar' );
			$GLOBALS['gp_featured_image'] = redux_post_meta( 'gp', get_the_ID(), 'post_featured_image' ) == 'default' ? $gp_global['post_featured_image'] : redux_post_meta( 'gp', get_the_ID(), 'post_featured_image' );
			$image = redux_post_meta( 'gp', get_the_ID(), 'post_image' );
			$GLOBALS['gp_image_width'] = ! empty( $image['width'] ) ? $image['width'] : $gp_global['post_image']['width'];
			$GLOBALS['gp_image_height'] = ! empty( $image['height'] ) ? $image['height'] : $gp_global['post_image']['height'];
			$GLOBALS['gp_hard_crop'] = redux_post_meta( 'gp', get_the_ID(), 'post_hard_crop' ) == 'default' ? $gp_global['post_hard_crop'] : redux_post_meta( 'gp', get_the_ID(), 'post_hard_crop' );
			$GLOBALS['gp_image_alignment'] = redux_post_meta( 'gp', get_the_ID(), 'post_image_alignment' ) == 'default' ? $gp_global['post_image_alignment'] : redux_post_meta( 'gp', get_the_ID(), 'post_image_alignment' );
			$GLOBALS['gp_meta_author'] = $gp_global['post_meta']['author'];
			$GLOBALS['gp_meta_date'] = $gp_global['post_meta']['date'];
			$GLOBALS['gp_meta_comment_count'] = $gp_global['post_meta']['comment_count'];
			$GLOBALS['gp_meta_views'] = $gp_global['post_meta']['views'];
			$GLOBALS['gp_meta_cats'] = $gp_global['post_meta']['cats'];
			$GLOBALS['gp_meta_tags'] = $gp_global['post_meta']['tags'];
	
	
		/*--------------------------------------------------------------
		Slides
		--------------------------------------------------------------*/

		} elseif ( is_singular( 'gp_slide' ) ) {

			$GLOBALS['gp_title'] = 'gp-no-large-title';
			$GLOBALS['gp_layout'] = 'gp-no-sidebar';
	
	
		/*--------------------------------------------------------------
		Pages
		--------------------------------------------------------------*/

		} elseif ( is_page() ) {

			if ( get_post_meta( $post->post_parent, '_wp_page_template', true ) == 'hub-template.php' && redux_post_meta( 'gp', $post->post_parent, 'hub_title' ) == 'default' ) {
				$GLOBALS['gp_title'] = $gp_global['hub_title'];
			} elseif ( get_post_meta( $post->post_parent, '_wp_page_template', true ) == 'hub-template.php' ) {
				$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'hub_title' ) ? redux_post_meta( 'gp', get_the_ID(), 'hub_title' ) : '';
			} elseif ( redux_post_meta( 'gp', get_the_ID(), 'page_title' ) == 'default' ) {
				$GLOBALS['gp_title'] = $gp_global['page_title'];
			} else {
				$GLOBALS['gp_title'] = redux_post_meta( 'gp', get_the_ID(), 'page_title' );
			}

			$GLOBALS['gp_title_text'] = redux_post_meta( 'gp', get_the_ID(), 'page_title_text' );
			$GLOBALS['gp_custom_title'] = redux_post_meta( 'gp', get_the_ID(), 'page_custom_title' );
			$GLOBALS['gp_subtitle'] = redux_post_meta( 'gp', get_the_ID(), 'page_subtitle' );
			$GLOBALS['gp_title_bg'] = redux_post_meta( 'gp', get_the_ID(), 'page_title_bg' );
			$GLOBALS['gp_teaser_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'page_title_teaser_video_bg' );
			$GLOBALS['gp_full_video_bg'] = redux_post_meta( 'gp', get_the_ID(), 'page_title_full_video_bg' );
			$GLOBALS['gp_layout'] = redux_post_meta( 'gp', get_the_ID(), 'page_layout' ) == 'default' ? $gp_global['page_layout'] : redux_post_meta( 'gp', get_the_ID(), 'page_layout' );
			$GLOBALS['gp_sidebar'] = redux_post_meta( 'gp', get_the_ID(), 'page_sidebar' ) == '' ? $gp_global['page_sidebar'] : redux_post_meta( 'gp', get_the_ID(), 'page_sidebar' );
			$GLOBALS['gp_featured_image'] = redux_post_meta( 'gp', get_the_ID(), 'page_featured_image' ) == 'default' ? $gp_global['page_featured_image'] : redux_post_meta( 'gp', get_the_ID(), 'page_featured_image' );
			$image = redux_post_meta( 'gp', get_the_ID(), 'page_image' );
			$GLOBALS['gp_image_width'] = ! empty( $image['width'] ) ? $image['width'] : $gp_global['page_image']['width'];
			$GLOBALS['gp_image_height'] = ! empty( $image['height'] ) ? $image['height'] : $gp_global['page_image']['height'];
			$GLOBALS['gp_hard_crop'] = redux_post_meta( 'gp', get_the_ID(), 'page_hard_crop' ) == 'default' ? $gp_global['page_hard_crop'] : redux_post_meta( 'gp', get_the_ID(), 'page_hard_crop' );
			$GLOBALS['gp_image_alignment'] = redux_post_meta( 'gp', get_the_ID(), 'page_image_alignment' ) == 'default' ? $gp_global['page_image_alignment'] : redux_post_meta( 'gp', get_the_ID(), 'page_image_alignment' );


		/*--------------------------------------------------------------
		Custom Post Types
		--------------------------------------------------------------*/

		} else {

			$GLOBALS['gp_title'] = 'gp-no-large-title';
			$GLOBALS['gp_layout'] = 'gp-no-sidebar';

		}
		
		/*--------------------------------------------------------------
		Fallbacks for v2.9 and below
		--------------------------------------------------------------*/
		
		if ( isset( $GLOBALS['gp_format'] ) && empty( $GLOBALS['gp_format'] ) ) {
			$GLOBALS['gp_format'] = 'blog-columns';
		}	

	}
}

?>