<?php

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

		if ( ( ( ! isset( $GLOBALS['gp_shortcode'] ) && ! isset( $_GET['type'] ) ) OR ( isset( $_GET['type'] ) && ( $_GET['type'] != 'news' && $_GET['type'] != 'video' && $_GET['type'] != 'blog' ) ) ) && ( ! isset( $GLOBALS['gp_menu'] ) OR $GLOBALS['gp_menu'] == null ) ) {

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


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

			if ( is_page_template( 'portfolio-template.php' ) )  {

				$GLOBALS['gp_cats'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_cats' ) ? implode( ',', redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_cats' ) ) : '';			
				$GLOBALS['gp_orderby'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_orderby' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_orderby' ) : '';
				$GLOBALS['gp_date_posted'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_date_posted' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_date_posted' ) : '';
				$GLOBALS['gp_date_modified'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_date_modified' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_date_modified' ) : '';
				$GLOBALS['gp_per_page'] = redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_per_page' ) ? redux_post_meta( 'gp', get_the_ID(), 'portfolio_template_per_page' ) : '';
				$GLOBALS['gp_page_numbers'] = 'enabled';


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

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

				$GLOBALS['gp_cats'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_cats' ) ? implode( ',', redux_post_meta( 'gp', get_the_ID(), 'blog_template_cats' ) ) : '';	
				$GLOBALS['gp_post_types'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_post_types' ) ? implode( ',', redux_post_meta( 'gp', get_the_ID(), 'blog_template_post_types' ) ) : '';
				$GLOBALS['gp_format'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_format' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_format' ) : '';
				$GLOBALS['gp_size'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_size' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_size' ) : '';	
				$GLOBALS['gp_orderby'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_orderby' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_orderby' ) : '';				
				$GLOBALS['gp_date_posted'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_date_posted' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_date_posted' ) : '';	
				$GLOBALS['gp_date_modified'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_date_modified' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_date_modified' ) : '';
				$GLOBALS['gp_filter'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_filter' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_filter' ) : '';
				$filter_options = redux_post_meta( 'gp', get_the_ID(), 'blog_template_filter_options' );		
				$GLOBALS['gp_filter_cats'] = isset( $filter_options['cats'] ) ? $filter_options['cats'] : '';	
				$GLOBALS['gp_filter_date'] = isset( $filter_options['date'] ) ? $filter_options['date'] : '';	
				$GLOBALS['gp_filter_title'] = isset( $filter_options['title'] ) ? $filter_options['title'] : '';	
				$GLOBALS['gp_filter_comment_count'] = isset( $filter_options['comment_count'] ) ? $filter_options['comment_count'] : '';	
				$GLOBALS['gp_filter_views'] = isset( $filter_options['views'] ) ? $filter_options['views'] : '';		
				$GLOBALS['gp_filter_followers'] = isset( $filter_options['followers'] ) ? $filter_options['followers'] : '';	
				$GLOBALS['gp_filter_site_rating'] = isset( $filter_options['site_rating'] ) ? $filter_options['site_rating'] : '';	
				$GLOBALS['gp_filter_user_rating'] = isset( $filter_options['user_rating'] ) ? $filter_options['user_rating'] : '';	
				$GLOBALS['gp_filter_hub_awards'] = isset( $filter_options['hub_awards'] ) ? $filter_options['hub_awards'] : '';
				$GLOBALS['gp_filter_date_posted'] = isset( $filter_options['date_posted'] ) ? $filter_options['date_posted'] : '';
				$GLOBALS['gp_filter_date_modified'] = isset( $filter_options['date_modified'] ) ? $filter_options['date_modified'] : '';
				$GLOBALS['gp_filter_cats_id'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_filter_cats_id' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_filter_cats_id' ) : '';				
				$GLOBALS['gp_per_page'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_per_page' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_per_page' ) : '';
				$GLOBALS['gp_featured_image'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_featured_image' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_featured_image' ) : '';
				$image = redux_post_meta( 'gp', get_the_ID(), 'blog_template_image' );
				$GLOBALS['gp_image_width'] = isset( $image['width'] ) ? $image['width'] : '';	
				$GLOBALS['gp_image_height'] = isset( $image['height'] ) ? $image['height'] : '';	
				$GLOBALS['gp_hard_crop'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_hard_crop' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_hard_crop' ) : '';	
				$GLOBALS['gp_image_alignment'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_image_alignment' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_image_alignment' ) : '';	
				$GLOBALS['gp_title_position'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_title_position' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_title_position' ) : '';	
				$GLOBALS['gp_content_display'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_content_display' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_content_display' ) : '';	
				$GLOBALS['gp_excerpt_length'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_excerpt_length' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_excerpt_length' ) : 0;	
				$meta = redux_post_meta( 'gp', get_the_ID(), 'blog_template_meta' );
				$GLOBALS['gp_meta_author'] = isset( $meta['author'] ) ? $meta['author'] : '';	
				$GLOBALS['gp_meta_date'] = isset( $meta['date'] ) ? $meta['date'] : '';
				$GLOBALS['gp_meta_comment_count'] = isset( $meta['comment_count'] ) ? $meta['comment_count'] : '';	
				$GLOBALS['gp_meta_views'] = isset( $meta['views'] ) ? $meta['views'] : '';
				$GLOBALS['gp_meta_followers'] = isset( $meta['followers'] ) ? $meta['followers'] : '';	
				$GLOBALS['gp_meta_cats'] = isset( $meta['cats'] ) ? $meta['cats'] : '';
				$GLOBALS['gp_meta_tags'] = isset( $meta['tags'] ) ? $meta['tags'] : '';	
				$GLOBALS['gp_meta_hub_cats'] = isset( $meta['hub_cats'] ) ? $meta['hub_cats'] : '';	
				$GLOBALS['gp_meta_hub_fields'] = isset( $meta['hub_fields'] ) ? $meta['hub_fields'] : '';	
				$GLOBALS['gp_meta_hub_award'] = isset( $meta['hub_award'] ) ? $meta['hub_award'] : '';
				$display_rating = redux_post_meta( 'gp', get_the_ID(), 'blog_template_display_rating' );
				$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'] = isset( $display_rating['site_rating'] ) ? $display_rating['site_rating'] : '';
				$GLOBALS['gp_display_user_rating'] = isset( $display_rating['user_rating'] ) ? $display_rating['user_rating'] : '';
				$GLOBALS['gp_read_more_link'] = redux_post_meta( 'gp', get_the_ID(), 'blog_template_read_more_link' ) ? redux_post_meta( 'gp', get_the_ID(), 'blog_template_read_more_link' ) : '';					
				$GLOBALS['gp_page_numbers'] = 'enabled';	

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

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

				$GLOBALS['gp_format'] = 'blog-standard';
				$GLOBALS['gp_size'] = 'blog-standard-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'] = 75;
				$GLOBALS['gp_image_height'] = 75;
				$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'] = 'excerpt';
				$GLOBALS['gp_excerpt_length'] = '0';
				$GLOBALS['gp_meta_author'] = '0';
				$GLOBALS['gp_meta_date'] = '0';
				$GLOBALS['gp_meta_comment_count'] = '0';
				$GLOBALS['gp_meta_views'] = '0';
				$GLOBALS['gp_meta_followers'] = '1';
				$GLOBALS['gp_meta_tags'] = '0';	
				$GLOBALS['gp_meta_hub_cats'] = '';
				$GLOBALS['gp_meta_hub_fields'] = '';
				$GLOBALS['gp_meta_hub_award'] = '0';	
				$GLOBALS['gp_display_site_rating'] = '0';
				$GLOBALS['gp_display_user_rating'] = '0';	
				$GLOBALS['gp_read_more_link'] = '0';
				$GLOBALS['gp_page_numbers'] = 'enabled';


			/*--------------------------------------------------------------
			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' ) : '';
				$GLOBALS['gp_cats'] = redux_post_meta( 'gp', get_the_ID(), 'flexslider_cats' ) ? implode( ',', redux_post_meta( 'gp', get_the_ID(), 'flexslider_cats' ) ) : '';
				$GLOBALS['gp_timeout'] = redux_post_meta( 'gp', get_the_ID(), 'flexslider_timeout' ) ? redux_post_meta( 'gp', get_the_ID(), 'flexslider_timeout' ) : '';
				$GLOBALS['gp_side_gradient_overlay'] = redux_post_meta( 'gp', get_the_ID(), 'flexslider_side_gradient_overlay' ) ? redux_post_meta( 'gp', get_the_ID(), 'flexslider_side_gradient_overlay' ) : '';
				$GLOBALS['gp_bottom_gradient_overlay'] = redux_post_meta( 'gp', get_the_ID(), 'flexslider_bottom_gradient_overlay' ) ? redux_post_meta( 'gp', get_the_ID(), 'flexslider_bottom_gradient_overlay' ) : '';
				$image = redux_post_meta( 'gp', get_the_ID(), 'flexslider_dimensions' );
				$GLOBALS['gp_slider_width'] = ! empty( $image['width'] ) ? $image['width'] : $gp_global['flexslider_dimensions']['width'];
				$GLOBALS['gp_slider_height'] = ! empty( $image['height'] ) ? $image['height'] : $gp_global['flexslider_dimensions']['height'];
				$GLOBALS['gp_per_page'] = redux_post_meta( 'gp', get_the_ID(), 'flexslider_per_page' ) ? redux_post_meta( 'gp', get_the_ID(), 'flexslider_per_page' ) : '';


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

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

				$GLOBALS['gp_cats'] = redux_post_meta( 'gp', get_the_ID(), 'featured_cats' ) ? implode( ',', redux_post_meta( 'gp', get_the_ID(), 'featured_cats' ) ) : '';
				$GLOBALS['gp_side_gradient_overlay'] = redux_post_meta( 'gp', get_the_ID(), 'featured_side_gradient_overlay' ) ? redux_post_meta( 'gp', get_the_ID(), 'featured_side_gradient_overlay' ) : '';
				$GLOBALS['gp_bottom_gradient_overlay'] = redux_post_meta( 'gp', get_the_ID(), 'featured_bottom_gradient_overlay' ) ? redux_post_meta( 'gp', get_the_ID(), 'featured_bottom_gradient_overlay' ) : '';
				$image = redux_post_meta( 'gp', get_the_ID(), 'featured_dimensions' );
				$GLOBALS['gp_slider_width'] = ! empty( $image['width'] ) ? $image['width'] : $gp_global['featured_dimensions']['width'];
				$GLOBALS['gp_slider_height'] = ! empty( $image['height'] ) ? $image['height'] : $gp_global['featured_dimensions']['height'];
				$GLOBALS['gp_per_page'] = redux_post_meta( 'gp', get_the_ID(), 'featured_per_page' ) ? redux_post_meta( 'gp', get_the_ID(), 'featured_per_page' ) : '';

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

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

				$GLOBALS['gp_cats'] = redux_post_meta( 'gp', get_the_ID(), 'news_cats' ) ? implode( ',', redux_post_meta( 'gp', get_the_ID(), 'news_cats' ) ) : '';			
				$GLOBALS['gp_format'] = $gp_global['news_format'];
				$GLOBALS['gp_size'] = $gp_global['news_size'];
				$GLOBALS['gp_orderby'] = isset( $gp_global['news_orderby'] ) ? $gp_global['news_orderby'] : 'date';
				$GLOBALS['gp_date_posted'] = $gp_global['news_date_posted'];
				$GLOBALS['gp_date_modified'] = $gp_global['news_date_modified'];
				$GLOBALS['gp_filter'] = $gp_global['news_filter'];
				$GLOBALS['gp_filter_cats'] = $gp_global['news_filter_options']['cats'];
				$GLOBALS['gp_filter_date'] = $gp_global['news_filter_options']['date'];
				$GLOBALS['gp_filter_title'] = $gp_global['news_filter_options']['title'];
				$GLOBALS['gp_filter_comment_count'] = $gp_global['news_filter_options']['comment_count'];	
				$GLOBALS['gp_filter_views'] = $gp_global['news_filter_options']['views'];
				$GLOBALS['gp_filter_date_posted'] = $gp_global['news_filter_options']['date_posted'];	
				$GLOBALS['gp_filter_date_modified'] = $gp_global['news_filter_options']['date_modified'];
				$GLOBALS['gp_filter_cats_id'] = $gp['news_filter_cats_id'] ? $gp['news_filter_cats_id'] : '';
				$GLOBALS['gp_per_page'] = $gp_global['news_per_page'];
				$GLOBALS['gp_featured_image'] = $gp_global['news_featured_image'];
				$GLOBALS['gp_image_width'] = $gp_global['news_image']['width'];
				$GLOBALS['gp_image_height'] = $gp_global['news_image']['height'];
				$GLOBALS['gp_hard_crop'] = $gp_global['news_hard_crop'];
				$GLOBALS['gp_image_alignment'] = $gp_global['news_image_alignment'];
				$GLOBALS['gp_title_position'] = $gp_global['news_title_position'];
				$GLOBALS['gp_content_display'] = $gp_global['news_content_display'];
				$GLOBALS['gp_excerpt_length'] = $gp_global['news_excerpt_length'];
				$GLOBALS['gp_meta_author'] = $gp_global['news_meta']['author'];
				$GLOBALS['gp_meta_date'] = $gp_global['news_meta']['date'];
				$GLOBALS['gp_meta_comment_count'] = $gp_global['news_meta']['comment_count'];
				$GLOBALS['gp_meta_views'] = $gp_global['news_meta']['views'];
				$GLOBALS['gp_meta_cats'] = $gp_global['news_meta']['cats'];
				$GLOBALS['gp_meta_tags'] = $gp_global['news_meta']['tags'];
				$GLOBALS['gp_read_more_link'] = $gp_global['news_read_more_link'];				
				$GLOBALS['gp_page_numbers'] = 'enabled';


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

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

				$GLOBALS['gp_cats'] = redux_post_meta( 'gp', get_the_ID(), 'videos_cats' ) ? implode( ',', redux_post_meta( 'gp', get_the_ID(), 'videos_cats' ) ) : '';
				$GLOBALS['gp_format'] = $gp_global['videos_format'];
				$GLOBALS['gp_size'] = $gp_global['videos_size'];
				$GLOBALS['gp_orderby'] = isset( $gp_global['videos_orderby'] ) ? $gp_global['videos_orderby'] : 'date';
				$GLOBALS['gp_date_posted'] = $gp_global['videos_date_posted'];	
				$GLOBALS['gp_date_modified'] = $gp_global['videos_date_modified'];		
				$GLOBALS['gp_filter'] = $gp_global['videos_filter'];
				$GLOBALS['gp_filter_cats'] = $gp_global['videos_filter_options']['cats'];
				$GLOBALS['gp_filter_date'] = $gp_global['videos_filter_options']['date'];
				$GLOBALS['gp_filter_title'] = $gp_global['videos_filter_options']['title'];
				$GLOBALS['gp_filter_comment_count'] = $gp_global['videos_filter_options']['comment_count'];
				$GLOBALS['gp_filter_views'] = $gp_global['videos_filter_options']['views'];
				$GLOBALS['gp_filter_date_posted'] = $gp_global['videos_filter_options']['date_posted'];	
				$GLOBALS['gp_filter_date_modified'] = $gp_global['videos_filter_options']['date_modified'];
				$GLOBALS['gp_filter_cats_id'] = $gp['videos_filter_cats_id'] ? $gp['videos_filter_cats_id'] : '';
				$GLOBALS['gp_per_page'] = $gp_global['videos_per_page'];	
				$GLOBALS['gp_featured_image'] = $gp_global['videos_featured_image'];
				$GLOBALS['gp_image_width'] = $gp_global['videos_image']['width'];
				$GLOBALS['gp_image_height'] = $gp_global['videos_image']['height'];
				$GLOBALS['gp_hard_crop'] = $gp_global['videos_hard_crop'];
				$GLOBALS['gp_image_alignment'] = $gp_global['videos_image_alignment'];
				$GLOBALS['gp_title_position'] = $gp_global['videos_title_position'];
				$GLOBALS['gp_content_display'] = $gp_global['videos_content_display'];
				$GLOBALS['gp_excerpt_length'] = $gp_global['videos_excerpt_length'];
				$GLOBALS['gp_meta_author'] = $gp_global['videos_meta']['author'];
				$GLOBALS['gp_meta_date'] = $gp_global['videos_meta']['date'];
				$GLOBALS['gp_meta_comment_count'] = $gp_global['videos_meta']['comment_count'];
				$GLOBALS['gp_meta_views'] = $gp_global['videos_meta']['views'];
				$GLOBALS['gp_meta_cats'] = $gp_global['videos_meta']['cats'];
				$GLOBALS['gp_meta_tags'] = $gp_global['videos_meta']['tags'];
				$GLOBALS['gp_read_more_link'] = $gp_global['videos_read_more_link'];
				$GLOBALS['gp_page_numbers'] = 'enabled';


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

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

				$GLOBALS['gp_format'] = 'blog-standard';
				$GLOBALS['gp_size'] = 'blog-standard-size';
				$GLOBALS['gp_per_page'] = $gp_global['user_reviews_per_page'];
				$GLOBALS['gp_featured_image'] = $gp_global['user_reviews_featured_image'];
				$GLOBALS['gp_image_width'] = $gp_global['user_reviews_image']['width'];
				$GLOBALS['gp_image_height'] = $gp_global['user_reviews_image']['height'];
				$GLOBALS['gp_hard_crop'] = $gp_global['user_reviews_hard_crop'];
				$GLOBALS['gp_image_alignment'] = $gp_global['user_reviews_image_alignment'];
				$GLOBALS['gp_title_position'] = 'title-next-to-thumbnail';
				$GLOBALS['gp_content_display'] = $gp_global['user_reviews_content_display'];
				$GLOBALS['gp_excerpt_length'] = $gp_global['user_reviews_excerpt_length'];
				$GLOBALS['gp_meta_author'] = $gp_global['user_reviews_meta']['author'];
				$GLOBALS['gp_meta_date'] = $gp_global['user_reviews_meta']['date'];
				$GLOBALS['gp_meta_comment_count'] = $gp_global['user_reviews_meta']['comment_count'];
				$GLOBALS['gp_meta_views'] = $gp_global['user_reviews_meta']['views'];
				$GLOBALS['gp_read_more_link'] = $gp_global['user_reviews_read_more_link'];
				$GLOBALS['gp_page_numbers'] = 'enabled';


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

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

				$GLOBALS['gp_format'] = 'blog-standard';
				$GLOBALS['gp_size'] = 'blog-small-size';
				$GLOBALS['gp_per_page'] = -1;
				$GLOBALS['gp_featured_image'] = 'disabled';
				$GLOBALS['gp_title_position'] = 'title-next-to-thumbnail';
				$GLOBALS['gp_content_display'] = 'excerpt';
				$GLOBALS['gp_excerpt_length'] = '0';
				$GLOBALS['gp_meta_author'] = '0';
				$GLOBALS['gp_meta_date'] = '0';
				$GLOBALS['gp_meta_comment_count'] = '0';	
				$GLOBALS['gp_meta_tags'] = '0';
				$GLOBALS['gp_meta_hub_award'] = '0';	
				$GLOBALS['gp_display_site_rating'] = '0';
				$GLOBALS['gp_display_user_rating'] = '0';	
				$GLOBALS['gp_read_more_link'] = '0';
				
			}	

			/*--------------------------------------------------------------
			Fallbacks for v2.9 and below
			--------------------------------------------------------------*/

			if ( isset( $GLOBALS['gp_format'] ) && empty( $GLOBALS['gp_format'] ) ) {
				$GLOBALS['gp_format'] = 'blog-columns';
			}

		}


		/*--------------------------------------------------------------
		Global values for queries
		--------------------------------------------------------------*/
								
		// Pagination
		if ( get_query_var( 'paged' ) ) {
			$GLOBALS['gp_paged'] = get_query_var( 'paged' );
		} elseif ( get_query_var( 'page' ) ) {
			$GLOBALS['gp_paged'] = get_query_var( 'page' );
		} else {
			$GLOBALS['gp_paged'] = 1;
		}
		
		// Fix for incorrect category ID being applied before resaving page
		if ( isset( $GLOBALS['gp_cats'] ) && ( ( ( ! isset( $GLOBALS['gp_shortcode'] ) && ! isset( $_GET['type'] ) ) OR ( isset( $_GET['type'] ) && ( $_GET['type'] != 'news' && $_GET['type'] != 'video' && $_GET['type'] != 'blog' ) ) ) && ( ! isset( $GLOBALS['gp_menu'] ) OR $GLOBALS['gp_menu'] == null ) ) ) {
			if ( ! term_exists( (int) $GLOBALS['gp_cats'] ) ) { $GLOBALS['gp_cats'] = ''; }	
		}

		// Categories
		if ( ! empty( $GLOBALS['gp_cats'] ) && preg_match( '/^[a-zA-Z\-]+/', $GLOBALS['gp_cats'] ) ) {
			$GLOBALS['gp_hub_cats'] = array( 'taxonomy' => 'gp_hubs', 'terms' => explode( ',', $GLOBALS['gp_cats'] ), 'field' => 'slug' );
			$GLOBALS['gp_video_cats'] = array( 'taxonomy' => 'gp_videos', 'terms' => explode( ',', $GLOBALS['gp_cats'] ), 'field' => 'slug' );
			$GLOBALS['gp_post_cats'] = array( 'taxonomy' => 'category', 'terms' => explode( ',', $GLOBALS['gp_cats'] ), 'field' => 'slug' );
			$GLOBALS['gp_slide_cats'] = array( 'taxonomy' => 'gp_slides', 'terms' => explode( ',', $GLOBALS['gp_cats'] ), 'field' => 'slug' );
			$GLOBALS['gp_portfolio_cats'] = array( 'taxonomy' => 'gp_portfolios', 'terms' => explode( ',', $GLOBALS['gp_cats'] ), 'field' => 'slug' );
		} elseif ( ! empty( $GLOBALS['gp_cats'] ) ) {
			$GLOBALS['gp_hub_cats'] = array( 'taxonomy' => 'gp_hubs', 'terms' => explode( ',', $GLOBALS['gp_cats'] ), 'field' => 'id' );
			$GLOBALS['gp_video_cats'] = array( 'taxonomy' => 'gp_videos', 'terms' => explode( ',', $GLOBALS['gp_cats'] ), 'field' => 'id' );
			$GLOBALS['gp_post_cats'] = array( 'taxonomy' => 'category', 'terms' => explode( ',', $GLOBALS['gp_cats'] ), 'field' => 'id' );
			$GLOBALS['gp_slide_cats'] = array( 'taxonomy' => 'gp_slides', 'terms' => explode( ',', $GLOBALS['gp_cats'] ), 'field' => 'id' );
			$GLOBALS['gp_portfolio_cats'] = array( 'taxonomy' => 'gp_portfolios', 'terms' => explode( ',', $GLOBALS['gp_cats'] ), 'field' => 'id' );
		} else {
			$GLOBALS['gp_hub_cats'] = null;
			$GLOBALS['gp_video_cats'] = null;
			$GLOBALS['gp_post_cats'] = null;
			$GLOBALS['gp_slide_cats'] = null;
			$GLOBALS['gp_portfolio_cats'] = null;
		}
			
					
		// Orderby
		if ( isset( $GLOBALS['gp_orderby'] ) ) {
				
			if ( $GLOBALS['gp_orderby'] == 'newest' ) {
				$GLOBALS['gp_orderby_value'] = 'date';
				$GLOBALS['gp_order'] = 'desc';
				$GLOBALS['gp_meta_key'] = '';
			} elseif ( $GLOBALS['gp_orderby'] == 'oldest' ) {
				$GLOBALS['gp_orderby_value'] = 'date';
				$GLOBALS['gp_order'] = 'asc';
				$GLOBALS['gp_meta_key'] = '';				
			} elseif ( $GLOBALS['gp_orderby']  == 'title_az' ) {
				$GLOBALS['gp_orderby_value'] = 'title';
				$GLOBALS['gp_order'] = 'asc';
				$GLOBALS['gp_meta_key'] = '';	
			} elseif ( $GLOBALS['gp_orderby']  == 'title_za' ) {
				$GLOBALS['gp_orderby_value'] = 'title';
				$GLOBALS['gp_order'] = 'desc';
				$GLOBALS['gp_meta_key'] = '';									
			} elseif ( $GLOBALS['gp_orderby'] == 'comment_count' ) {
				$GLOBALS['gp_orderby_value'] = 'comment_count';
				$GLOBALS['gp_order'] = 'desc';
				$GLOBALS['gp_meta_key'] = '';	
			} elseif ( $GLOBALS['gp_orderby'] == 'views' ) {
				$GLOBALS['gp_orderby_value'] = 'post_views';
				$GLOBALS['gp_order'] = 'desc';
				$GLOBALS['gp_meta_key'] = '';		
			} elseif ( $GLOBALS['gp_orderby'] == 'followers' ) {
				$GLOBALS['gp_orderby_value'] = 'meta_value_num';
				$GLOBALS['gp_order'] = 'desc';
				$GLOBALS['gp_meta_key'] = '_gp_followers';			
			} elseif ( $GLOBALS['gp_orderby'] == 'site_rating' ) {
				$GLOBALS['gp_orderby_value'] = 'meta_value_num';
				$GLOBALS['gp_order'] = 'desc';
				$GLOBALS['gp_meta_key'] = '_gp_site_rating';	
			} elseif ( $GLOBALS['gp_orderby']  == 'user_rating' ) {
				$GLOBALS['gp_orderby_value'] = 'meta_value_num';
				$GLOBALS['gp_order'] = 'desc';
				$GLOBALS['gp_meta_key'] = '_gp_user_rating';			
			} elseif ( $GLOBALS['gp_orderby'] == 'hub_awards' ) {
				$GLOBALS['gp_orderby_value'] = 'meta_value';
				$GLOBALS['gp_order'] = 'asc';
				$GLOBALS['gp_meta_key'] = 'hub_award';	
			} elseif ( $GLOBALS['gp_orderby'] == 'menu_order' ) {
				$GLOBALS['gp_orderby_value'] = 'menu_order';
				$GLOBALS['gp_order'] = 'asc';
				$GLOBALS['gp_meta_key'] = '';	
			} elseif ( $GLOBALS['gp_orderby'] == 'rand' ) {
				$GLOBALS['gp_orderby_value'] = 'rand';
				$GLOBALS['gp_order'] = 'asc';
				$GLOBALS['gp_meta_key'] = '';	
			} else {
				$GLOBALS['gp_orderby_value'] = '';
				$GLOBALS['gp_order'] = '';
				$GLOBALS['gp_meta_key'] = '';	
			}
		}	

		// Date posted
		if ( isset( $GLOBALS['gp_date_posted'] ) ) {			
			if ( $GLOBALS['gp_date_posted'] == 'day' ) {
				$GLOBALS['gp_date_posted_value'] = array(
					'column' => 'post_date_gmt',
					'after' => '1 day ago',
				);	
			} elseif ( $GLOBALS['gp_date_posted'] == 'week' ) {	
				$GLOBALS['gp_date_posted_value'] = array(	
					'column' => 'post_date_gmt',
					'after' => '1 week ago',
				);
			} elseif ( $GLOBALS['gp_date_posted'] == 'month' ) {	
				$GLOBALS['gp_date_posted_value'] = array(	
					'column' => 'post_date_gmt',
					'after' => '1 month ago',
				);
			} elseif ( $GLOBALS['gp_date_posted'] == 'year' ) {	
				$GLOBALS['gp_date_posted_value'] = array(	
					'column' => 'post_date_gmt',
					'after' => '1 year ago',
				);
			} elseif ( $GLOBALS['gp_date_posted'] == 'all' ) {	
				$GLOBALS['gp_date_posted_value'] = '';
			} else {
				$GLOBALS['gp_date_posted_value'] = '';
			}
		}	

		// Date modified
		if ( isset( $GLOBALS['gp_date_modified'] ) ) {			
			if ( $GLOBALS['gp_date_modified'] == 'day' ) {
				$GLOBALS['gp_date_modified_value'] = array(
					'column' => 'post_modified_gmt',
					'after' => '1 day ago',
				);	
			} elseif ( $GLOBALS['gp_date_modified'] == 'week' ) {	
				$GLOBALS['gp_date_modified_value'] = array(	
					'column' => 'post_modified_gmt',
					'after' => '1 week ago',
				);
			} elseif ( $GLOBALS['gp_date_modified'] == 'month' ) {	
				$GLOBALS['gp_date_modified_value'] = array(	
					'column' => 'post_modified_gmt',
					'after' => '1 month ago',
				);
			} elseif ( $GLOBALS['gp_date_modified'] == 'year' ) {	
				$GLOBALS['gp_date_modified_value'] = array(	
					'column' => 'post_modified_gmt',
					'after' => '1 year ago',
				);
			} elseif ( $GLOBALS['gp_date_modified'] == 'all' ) {	
				$GLOBALS['gp_date_modified_value'] = '';
			} else {
				$GLOBALS['gp_date_modified_value'] = '';
			}
		}	
									
	}	
}

?>