<?php get_header(); ?>
    <!-- Single -->
	<?php 
	    // Single 
	    if (have_posts()):
		while (have_posts()): the_post(); 
			global $authordata, $post;
			$edu_guru = get_post_meta($post->ID, 'edu_guru', true);
			$his_guru = get_post_meta($post->ID, 'his_guru', true);
			$nik = get_post_meta($post->ID, '_nik', true);
	    	$nip = get_post_meta($post->ID, '_nip', true);
	    	$nuptk = get_post_meta($post->ID, '_nuptk', true);
			$mas = get_post_meta($post->ID, '_mas', true);
	        $sex = get_post_meta($post->ID, '_sex', true);
	    	$tmpt = get_post_meta($post->ID, '_tmpt', true);
	    	$tgl = get_post_meta($post->ID, '_tgl', true);
	    	$rel = get_post_meta($post->ID, '_rel', true);
		
	    	$add = get_post_meta($post->ID, '_add', true);
	    	$telp = get_post_meta($post->ID, '_telp', true);
	    	$waguru = get_post_meta($post->ID, '_waguru', true);
	    	$mail = get_post_meta($post->ID, '_mail', true);
	    	$pressfb = get_post_meta($post->ID, '_pressfb', true);
	    	$presstw = get_post_meta($post->ID, '_presstw', true);
	    	$pressig = get_post_meta($post->ID, '_pressig', true);
			
			$tangmas = date_i18n("d F Y", strtotime($mas));
			$tangtgl = date_i18n("d M Y", strtotime($tgl));
		?>
		
		<div class="press_page">
	    	<div class="bread_in">
	            <?php // Top before content
		        	the_title( '<h1 class="press_heading">', '</h1>' ); 
		        	dimox_breadcrumbs(); 
	        	?>
        	</div>
    	</div>
		
		<section class="press_singlepost people">
	        <div class="press_container">
			
			    <div class="press_singlecontent clear">
					
					<div class="press_secondary">
						<div class="secondary_content">
						
						    <?php if (has_post_thumbnail()) {
					            echo '<div class="content_thumbnail">'.get_the_post_thumbnail($post->ID, 'photo',
    				                array(
				    	                'alt' => trim(strip_tags($post->post_title)),
				    	                'title' => trim(strip_tags($post->post_title)),
			    	                )).'</div>'; 
							} ?>
							
							<div class="clear content_meta"><?php the_title(); ?></div>
						
							<table class="cari_siswa">
							<?php if ( get_post_meta($post->ID, '_telp', true) !="" ) { ?>
							    <tr>
								    <td class="mini_icon"><i class="fa fa-phone"></i></td><td><strong><?php echo esc_html( $telp ); ?></strong></td>
					            </tr>
							<?php } ?>
							<?php if ( get_post_meta($post->ID, '_waguru', true) !="" ) { ?>
								<tr>
								    <td><i class="fa fa-whatsapp"></i></td><td><strong><?php echo esc_html( $waguru ); ?></strong></td>
					            </tr>
							<?php } ?>
							<?php if ( get_post_meta($post->ID, '_mail', true) !="" ) { ?>
								<tr>
								    <td><i class="fa fa-envelope"></i></td><td><?php echo esc_html( $mail ); ?></td>
					            </tr>
							<?php } ?>
							<?php if ( get_post_meta($post->ID, '_pressfb', true) !="" ) { ?>
								<tr>
								    <td><i class="fa fa-facebook"></i></td><td><?php echo esc_html( $pressfb ); ?></td>
					            </tr>
							<?php } ?>
							<?php if ( get_post_meta($post->ID, '_presstw', true) !="" ) { ?>
								<tr>
								    <td><i class="fa fa-twitter"></i></td><td><?php echo esc_html( $presstw ); ?></td>
					            </tr>
							<?php } ?>
							<?php if ( get_post_meta($post->ID, '_pressig', true) !="" ) { ?>
								<tr>
								    <td><i class="fa fa-instagram"></i></td><td><?php echo esc_html( $pressig ); ?></td>
					            </tr>
							<?php } ?>
							</table>
							
						</div>
			        </div>
					
					<div class="press_primary">
					    <div class="primary_content">
						
						    <div class="clear content_meta">
							    <div class="per_tiga">
							    	<span class="meta_icon"><i class="fa fa-clock-o"></i> <?php echo __( 'Aktif Mulai : ', 'prestasi' ); ?><strong><?php echo esc_html( $tangmas ); ?></strong></span>
                                </div>
								<div class="per_tiga">
							    	<span class="meta_icon"><i class="fa fa-circle-o"></i> <?php echo __( 'Jabatan : ', 'prestasi' ); ?><strong>
									    <?php
										    $terms = get_the_terms( $post->ID , 'jab' );
							                if ( $terms != null ){
									        	foreach( $terms as $term ) {
										        	$term_link = get_term_link( $term, 'jab');
										        	echo '<a href="' . $term_link . '">' . $term->name . '</a> ';
										        	unset($term); 
									        	} 
								        	} 
										?>
									</strong></span>
                                </div>
								<div class="per_tiga">
							     	<span class="meta_icon"><i class="fa fa-circle-o"></i> <?php echo __( 'Status : ', 'prestasi' ); ?><strong>
									    <?php
										    $terms = get_the_terms( $post->ID , 'stts' );
							                if ( $terms != null ){
									        	foreach( $terms as $term ) {
										        	$term_link = get_term_link( $term, 'stts');
										        	echo '<a href="' . $term_link . '">' . $term->name . '</a> ';
										        	unset($term); 
									        	} 
								        	} 
										?>
									</strong></span>
                                </div>
							</div>
							
							<div class="clear content_meta">
							    <div class="guru_data">
							    	<div class="per_dua">
								        <table class="guru_table">
									        <tr>
										        <td><strong><?php echo __( 'Jenis Kelamin', 'prestasi' ); ?></strong></td><td><?php echo esc_html( $sex ); ?></td>
									    	</tr>
								    		<tr>
								    		    <td><strong><?php echo __( 'T.T.L', 'prestasi' ); ?></strong></td><td><?php echo esc_html( $tmpt ); ?>, <?php echo esc_html( $tangtgl ); ?> </td>
							    			</tr>
								    		<tr>
								    		    <td><strong><?php echo __( 'Agama', 'prestasi' ); ?></strong></td><td><?php echo esc_html( $rel ); ?></td>
								    		</tr>
								    	</table>
						    		</div>
							    	<div class="per_dua">
								        <table class="guru_table">
									        <tr>
							    			    <td><strong><?php echo __( 'NIK', 'prestasi' ); ?></strong></td><td><?php echo esc_html( $nik ); ?></td>
							    			</tr>
							    			<tr>
							    			    <td><strong><?php echo __( 'NIP', 'prestasi' ); ?></strong></td><td><?php echo esc_html( $nip ); ?></td>
							    			</tr>
							    			<tr>
							    			    <td><strong><?php echo __( 'NUPTK', 'prestasi' ); ?></strong></td><td><?php echo esc_html( $nuptk ); ?></td>
							    			</tr>
							    		</table>
							    	</div>
								</div>
							</div>
							
							<div class="clear content_meta">
							<?php echo __( 'Alamat : ', 'prestasi' ); ?><?php echo esc_html( $add ); ?>
							</div>

							<div class="press_article">
							    <h3 class="art_title"><?php echo __( 'Profil Singkat', 'prestasi' ); ?></h3>
							    <?php 
									if ( !empty( get_the_content() ) ) {
										the_content();
									} else {
										echo __( 'Belum Ada Data', 'prestasi' );
									} 
								?>
							</div>
							
							<div class="after_art">
							    <h3 class="art_title"><?php echo __( 'Pendidikan', 'prestasi' ); ?></h3>
								<table class="cari_siswa">
								    <?php 
									    if (is_array($edu_guru)) {
											foreach ( $edu_guru as $edu ) { 
											?>
							                    <tr>
								                    <td class="front_td"><?php echo esc_html( $edu['eduname'] ); ?></td>
								                    <td class="front_bk"><strong><?php echo esc_html( $edu['eduyear'] ); ?></strong></td>
							                    </tr>
											<?php 
											} 
										} else { 
										    ?>
											    <tr><td><?php echo __( 'Belum Ada Data', 'prestasi' ); ?></td></tr>
											<?php 
										} 
									?>
						    	</table>
							
							    <h3 class="art_title"><?php echo __( 'Pekerjaan', 'prestasi' ); ?></h3>
								<table class="cari_siswa">
								    <?php 
									    if (is_array($his_guru)) {
											foreach ( $his_guru as $his ) { 
											?>
							                    <tr>
								                    <td class="front_td"><?php echo esc_html( $his['hisname'] ); ?></td>
								                    <td class="front_bk"><strong><?php echo esc_html( $his['hisyear'] ); ?></strong></td>
							                    </tr>
											<?php 
											} 
										} else { 
										    ?>
											    <tr><td><?php echo __( 'Belum Ada Data', 'prestasi' ); ?></td></tr>
											<?php 
										} 
									?>
						    	</table>
							</div>
							
							<?php  
							    latest_post_by_gurus();
							?>
						
						</div>
					</div>
					
				</div>
				
			</div>
		</section>
		
		<?php 
		endwhile; 
	    endif; 
	?>
	
<?php get_footer(); ?>