console.log( 'Code is Poetry' );
				
			
				
					<?php 
/* Template Name: Search Therapists */ 

get_header(); ?>
	</div>
	<div class="mb_top_images" style="background-image: url('<?php echo trailingslashit(get_site_url());?>wp-content/uploads/2017/01/safe_image.jpg');">
				<div class="mb_job_cover therapist">Our <span class="mb_bold">Therapists</span></div>
			</div>
	<div class="container">
	<div id="primary" class="content-area">
		<main id="main" class="site-main" role="main">
			<div class="mb_all_jobs">
				<h2 class="found_jobs_headline" style="
					float: none;
					display: block;
					text-align: center;
				"> <span class="mb_light found_jobs" style="margin-top: 14px;display: inline-block;">Currently, these therapists are looking for a job</span></h2>
				<div class="mb_found_these_ths mb_test_class">
				<?php
					$therapists = (array)get_field('mb_active_therapists','option');
					$found_user_ids = array();
					foreach($therapists as $therapist) {
						$user_id = $therapist['active_therapist'];
						if (!empty($user_id)) {
							$found_user_ids[] = $user_id;
							$permalink = trailingslashit(get_permalink(get_option('mb_th_profile_url'))).'?id='.$user_id;
							$full_user_id = 'user_'.$user_id;
							$pre = strtoupper(get_field('th_title',$full_user_id));
							$nickname = get_field('thai_nickname',$full_user_id);
							$title = $pre.'. '.$nickname;
							$gender = get_field('thai_nickname',$full_user_id);
							$bd = get_field('th_birthdate',$full_user_id);
							$age = '';
							$experience = (float)get_user_meta($user_id,'experience_in_days',true);
							$experience_html = '';
							if (!empty($experience)) {
								$experience_in_years = mb_round_up($experience / 365,0);
								if ($experience_in_years == 1) {
													$experience_html = ' | Experience: '.$experience_in_years.' year';
												}
												else {
													$experience_html = ' | Experience: '.$experience_in_years.' years';
												}
							}
							if (!empty($bd)) {
								$bd = date('Y-m-d',strtotime(str_replace('/','-',$bd)));
							# procedural
								$pre_age = date_diff(date_create($bd), date_create('today'))->y;
								if ($pre_age != 0) {
									$age = ' | '.$pre_age.' years';
								}
							}
							// Give full access to free users
							// if (is_user_logged_in()) {
							// 	$html = '<a href="'.$permalink.'" title="'.$title.'" class="mb_job mb_this_th" th_id="'.$user_id.'">';
							// 	$html .= '<div class="mb_overlay"><div class="mb_overlay_helper">View Therapist</div></div>';
							// }
							// else {
							// 	$html = '<div class="mb_job mb_this_th" th_id="'.$user_id.'">';
							// 	$html .= '<div class="mb_overlay"><a class="mb_overlay_helper" href="http://spa-company.com/login/">Please Login</a></div>';
							// }
							
							$html = '<a href="'.$permalink.'" title="'.$title.'" class="mb_job mb_this_th" th_id="'.$user_id.'">';
							$html .= '<div class="mb_overlay"><div class="mb_overlay_helper">View Therapist</div></div>';
							$premium = get_field('premium_therapist',$full_user_id);
							if (!empty($premium)) {
								$html .= '<div class="mb_premium"><span class="pe-7s-star"></span></div>';
							}
							$html .= '<div class="mb_left"><div class="mb_th_pic" style="background-image: url(\''.get_wp_user_avatar_src($user_id, 'thumbnail').'\');"><img decoding="async" src="'.get_wp_user_avatar_src($user_id, 'thumbnail').'" style="display: none;"/></div></div>';
							$html .= '<div class="mb_right"><span class="mb_job_title">'.$title.$age.$experience_html.'</span>';
							$current_salary = get_field('mb_th_current_salary',$full_user_id);
							$minimum_salary_to_go_work_abroad = get_field('minimum_salary_to_go_work_abroad',$full_user_id);
							$expected_salary = get_field('expected_salary',$full_user_id);
							if (!empty($current_salary) || !empty($minimum_salary_to_go_work_abroad) || !empty($expected_salary)) {
								$html .= '<span class="mb_th_sub_info"><span class="pe-7s-graph1"></span> ';
								if (!empty($current_salary)) {
									$html .= '<strong>Current Salary</strong>: '.$current_salary.'THB | ';
								}
								if (!empty($minimum_salary_to_go_work_abroad)) {
									$html .= '<strong>Minimum Salary to go work abroad</strong>: '.$minimum_salary_to_go_work_abroad.'THB | ';
								}
								if (!empty($expected_salary)) {
									$html .= '<strong>Expected Salary</strong>: '.$expected_salary.'THB';
								}
								$html .= '</span>';
							}
							else {
							//	$html .= '<br>';
							}
							

							$get_current_skills = get_field_object(mb_translate_fields('th_skills'),$full_user_id);
							$current_skills_array = array();
							if (!empty($get_current_skills)) {
								if (!empty($get_current_skills['value'])) {
									foreach($get_current_skills['value'] as $skill) {
										$term = get_term( $skill, 'th_skill', ARRAY_A);
										$current_skills_array[$skill] = $term['name'];
									}
								}
							}
							$i = 1;
							if (!empty($current_skills_array)) {
								$html .= '<div class="mb_skill_wrapper">';
								foreach ($current_skills_array as $skill) {
									if ( $i < 11) {
										$html .=  '<div class="mb_skill">'.$skill.'</div>';
									}
									if ($i == 11) {
										$html .= ' ...';
									}
									$i++;
								}
								$html .= '</div>';
							}

							$html .= '</div>';
							// if (is_user_logged_in()) {
							// 	$html .= '</a>';
							// }
							// else {
							// 	$html .= '</div>';
							// }
							$html .= '</a>';
							echo $html;
						}
					}
				?>
			</div>
			
			<?php
			while ( have_posts() ) : the_post();


			endwhile; // End of the loop.

			// The 2nd Loop
			?>
			<?php
				wp_nonce_field( -1, 'mb_nonce_field' );
			?>
			<div class="mb_job_search_top_row">
			<h2 class="found_jobs_headline" style="
				float: none;
				display: block;
				text-align: center;
				
			"> <span class="mb_light found_jobs" style="margin-top: 14px;display: inline-block;font-weight: 400;font-size: 22px;">Applicants who have been placed successfully</span></h2>
			</div>
			<div class="mb_found_these_ths mb_test_class">
			<?php

			///if ($therapists_first > 5) {
				echo '<div class="mb_load_more_ths active" style="display: none;"><span class="pe-7s-refresh"></span><div class="job_loader_text">Finding More Therapists</div></div>';
			//}
			// else {
			// 	echo '<div class="mb_load_more_ths inactive" style="display: none;"><span class="pe-7s-refresh"></span><div class="job_loader_text">Finding More Therapists</div></div>';
			// }
			// // Restore original Post Data
			// wp_reset_postdata();
		?>
			</div>
		</div>
		</main><!-- #main -->
	</div><!-- #primary -->

<?php
get_footer();