<?php global $gp; ?>

<?php if ( has_post_thumbnail( $GLOBALS['gp_post_id'] ) && $gp['hub_featured_image'] == 'enabled' ) { ?>

	<div class="image-align-left featured-content">
	
		<div class="post-thumbnail">

			<?php $image = aq_resize( wp_get_attachment_url( get_post_thumbnail_id( $GLOBALS['gp_post_id'] ) ), $gp['hub_image']['width'], $gp['hub_image']['height'], $gp['hub_hard_crop'], false, true ); ?>
			<?php if ( $gp['retina'] == 'gp-retina' ) {
				$retina = aq_resize( wp_get_attachment_url( get_post_thumbnail_id( $GLOBALS['gp_post_id'] ) ), $gp['hub_image']['width'] * 2, $gp['hub_image']['width'] * 2, $gp['hub_hard_crop'], true, true );
			} else {
				$retina = '';
			} ?>

			<img src="<?php echo esc_url( $image[0] ); ?>" data-rel="<?php echo esc_url( $retina ); ?>" width="<?php echo absint( $image[1] ); ?>" height="<?php echo absint( $image[2] ); ?>" alt="<?php if ( get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ) ) { echo get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ); } else { the_title_attribute( array( 'post' => $GLOBALS['gp_post_id'] ) ); } ?>" class="wp-post-image" />

		</div>

		<?php if ( function_exists( 'gp_follow_button' ) ) { gp_follow_button(); } ?>
		
	</div>
		
<?php } ?>	

<div class="hub-header-info image-align-left">
	
	<?php if ( get_post_meta( $GLOBALS['gp_post_id'], 'hub_title_text', true ) != 'disabled' ) { ?>
		<h1 class="entry-title"><?php if ( get_post_meta( $GLOBALS['gp_post_id'], 'hub_custom_title', true ) ) { echo get_post_meta( $GLOBALS['gp_post_id'], 'hub_custom_title', true ); } else { echo get_the_title( $GLOBALS['gp_post_id'] ); } ?></h1>	
	<?php } ?>
	
	<?php if ( get_post_meta( $GLOBALS['gp_post_id'], 'hub_award', true ) == '1' ) { ?>
		<span class="hub-award"><i class="fa <?php echo redux_post_meta( 'gp', $GLOBALS['gp_post_id'], 'hub_award_icon' ); ?>"></i><?php echo get_post_meta( $GLOBALS['gp_post_id'], 'hub_award_title', true ); ?></span>
	<?php } ?>
		
	<?php if ( isset( $gp['hub_header_cats'] ) && ! empty( $gp['hub_header_cats'][0] ) ) { ?>
	
		<div class="hub-header-cats">
	
			<?php foreach( $gp['hub_header_cats'] as $gp_hub_cat ) {
				if ( has_term( $gp_hub_cat, 'gp_hubs', $GLOBALS['gp_post_id'] ) ) {
					$term = get_term( $gp_hub_cat, 'gp_hubs' );
					$t_ID = $term->term_id;
					$term_data = get_option( "taxonomy_$t_ID");
					$term_link = get_term_link( $term, 'gp_hubs' );
					if ( ! $term_link OR is_wp_error( $term_link ) ) {
						continue;
					}
					?>
					<a href="<?php echo esC_url( $term_link ); ?>"><span<?php if ( $term_data['color'] ) { ?> style="background-color: <?php echo esc_attr( $term_data['color'] ); ?>"<?php } ?>><?php echo esc_attr( $term->name ); ?></span></a>
				<?php } ?>
			<?php } ?>
		
		</div><!-- END HUB HEADER CATEGORIES -->
		
	<?php } ?>
	
	<?php if ( isset( $gp['hub_header_fields'] ) && ! empty( $gp['hub_header_fields'][0] ) ) { ?>
	
		<div class="hub-header-fields">
			
			<?php foreach( $gp['hub_header_fields'] as $gp_hub_field ) {
				$taxonomy = get_taxonomy( $gp_hub_field );
				if ( ! $taxonomy ) {
					continue;
				}
				$name = $taxonomy->labels->singular_name;
				$term_list = get_the_term_list( $GLOBALS['gp_post_id'], $gp_hub_field, '<span>' . $name . ': ', ', ', '</span>' );		
				if ( ! $term_list OR is_wp_error( $term_list ) ) {
					continue;
				}	
				echo wp_kses_post( $term_list );	
			} ?>
			
		</div><!-- END HUB HEADER FIELDS -->
			
	<?php } ?>
	
	<?php if ( function_exists( 'gp_follow_button' ) ) { gp_follow_button(); } ?>
										
</div><!-- END HUB HEADER INFO -->

<?php if ( $GLOBALS['gp_site_rating_enabled'] == true OR $GLOBALS['gp_user_rating_enabled'] == true ) { ?>

	<div class="rating-wrapper">
		<?php if ( $GLOBALS['gp_site_rating_enabled'] == true ) { get_template_part( 'lib/sections/site', 'rating' ); } ?>
		<?php if ( $GLOBALS['gp_user_rating_enabled'] == true ) { get_template_part( 'lib/sections/user', 'rating' ); } ?>
	</div>
	
<?php } ?>