<?php
get_header();
?>

<main id="main" class="site-main">
	<div class="container">
		<div data-vc-full-width="true" data-vc-full-width-init="false" class="vc_row wpb_row vc_row-fluid vc_custom_1499329137499 vc_row-has-fill">
			<div class="wpb_column vc_column_container vc_col-sm-12">
				<div class="vc_column-inner vc_custom_1499682865666">
					<div class="wpb_wrapper">
						<h1 class="text-center vc_custom_heading vc_custom_1499336940014">
							<?php $currentprofession = $wp_query->get_queried_object(); ?>
							<?php
								$currentprofessionname = $currentprofession->name;
								echo esc_html( $currentprofessionname );
							?>
						</h1>
						<div class="vc_separator wpb_content_element vc_separator_align_center vc_sep_width_100 vc_sep_border_width_8 vc_sep_pos_align_center vc_separator_no_text vc_custom_1499329151727  vc_custom_1499329151727">
							<span class="vc_sep_holder vc_sep_holder_l">
								<span class="vc_sep_line custom-separator"></span>
							</span>
							<span class="vc_sep_holder vc_sep_holder_r">
								<span class="vc_sep_line custom-separator"></span>
							</span>
</div>

						<div class="wpb_raw_code wpb_content_element wpb_raw_html vc_custom_1499945026233">
							<div class="wpb_wrapper">
								<div class="row advisors main-concept-three ">
									<?php
									$args        = array(
										'post_type'      => 'attorneys',
										'profession'     => $currentprofessionname,
										'posts_per_page' => -1,
										'orderby'        => 'ID',
										'order'          => 'ASC',
									);
									$my_query    = null;
									$my_query    = new WP_Query( $args );
									if ( $my_query->have_posts() ) {
										while ( $my_query->have_posts() ) :
											$my_query->the_post();
									?>
											<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
												<!-- advisors-item -->
												<div class="advisors-item">
													<div class="row">
														<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
															<div class="pic">
																<a href="<?php the_permalink(); ?>">
																	<?php echo get_the_post_thumbnail( get_the_ID(),'advisors-areas' ); ?>
																</a>
															</div>
															<div class="data">
																<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
																<h5><?php echo esc_html( $currentprofessionname ); ?></h5>
															</div>
														</div>
														<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
															<div class="details">
																<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
																<p><?php echo substr( get_the_excerpt() , 0, 100 ); ?></p>
																<a class="btn" href="<?php the_permalink(); ?>">
																	<?php esc_html_e( 'Read More', 'attorneypress' ); ?> <i class="fa fa-angle-right"></i>
																</a>
																<ul class="contact">
																	<li class="email">
																		<i class="fa fa-envelope-square"></i>
																		<a href="mailto:<?php echo esc_attr( get_post_meta( get_the_ID(), 'attorney_email', true ) ); ?>"><?php echo esc_html( get_post_meta( get_the_ID(), 'attorney_email', true ) ); ?></a>
																	</li>
																	<li class="phone">
																		<i class="fa fa-phone-square"></i>
																		<a href="tel:<?php echo esc_attr( get_post_meta( get_the_ID(), 'attorney_phone', true ) ); ?>"><?php echo esc_html( get_post_meta( get_the_ID(), 'attorney_phone', true ) ); ?></a>
																	</li>
																</ul>
															</div>
														</div>
													</div>
												</div>
												<!-- advisors-item -->
											</div>

			<?php
			endwhile;
									} else {
			?>
			 <p><?php esc_html_e( 'No Post Found', 'attorneypress' ); ?></p>
			<?php
									}
									// Restore original Post Data.
									wp_reset_postdata();
			?>

						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<div class="vc_row-full-width vc_clearfix"></div>
</div>
</main>
<?php
	wp_register_style( 'attorneypress-advisors-listing', plugins_url( '/attorneypress-addons/advisors-areas-list/css/attorneypress-advisors-listing.css' ) );
	wp_enqueue_style( 'attorneypress-advisors-listing' );
?>
<?php
get_footer();
