<?php
/**
 * The template to display the agent's single page
 *
 * @package WordPress
 * @subpackage ThemeREX Addons
 * @since v1.6.22
 */

get_header();

while ( have_posts() ) { the_post();
	$trx_addons_meta = get_post_meta(get_the_ID(), 'trx_addons_options', true);
	?>
	<article id="post-<?php the_ID(); ?>" <?php post_class( 'agents_page itemscope' ); ?>
		itemscope itemtype="http://schema.org/Article">
		
		<section class="properties_page_section properties_page_agent">
			<div class="properties_page_agent_wrap"><?php
				trx_addons_get_template_part('cpt/properties/tpl.properties.parts.agent.php',
												'trx_addons_args_properties_agent',
												array(
													'meta' => array(
															'agent_type' => 'agent',
															'agent' => get_the_ID()
															)
												)
											);
			?></div>
		</section><!-- .properties_page_agent -->
		
		<?php
		$page_number = get_query_var('paged') 
							? get_query_var('paged') 
							: (get_query_var('page') 
								? get_query_var('page') 
								: 1);
		if ($page_number==1 && trim(get_the_content()) != '') {
			?><section class="properties_page_section properties_page_content entry-content" itemprop="articleBody"><?php
				?><h4 class="properties_page_section_title"><?php esc_html_e('About me', 'trx_addons'); ?></h4><?php
				the_content( );
			?></section><!-- .entry-content --><?php
		}
		?>

		<section class="properties_page_section properties_page_offers_list">
			<h4 class="properties_page_section_title"><?php esc_html_e('All my offers', 'trx_addons'); ?></h4><?php
			?><div class="properties_page_offers_list_wrap"><?php
				trx_addons_get_template_part('cpt/properties/tpl.properties.parts.loop.php',
												'trx_addons_args_properties_loop',
												array(
													'blog_style' => trx_addons_get_option('agents_properties_style'),
													'query_params' => array(
																		'properties_agent' => get_the_ID()
																		)
													)
											);
			?></div>
		</section><!-- .properties_page_list -->

	</article>
	<?php

	// If comments are open or we have at least one comment, load up the comment template.
	if ( comments_open() || get_comments_number() ) {
		comments_template();
	}
}

get_footer();
?>