<?php get_header(); ?>
    <!-- Single -->
	<?php 
	    // Single 
	    if (have_posts()):
		while (have_posts()): the_post(); 
			global $post;
			$mas = get_post_meta($post->ID, '_mas', true);
	    	$nisn = get_post_meta($post->ID, '_nisn', 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);
	    	$mail = get_post_meta($post->ID, '_mail', true);
	    	$anak = get_post_meta($post->ID, '_anak', true);
	    	$dari = get_post_meta($post->ID, '_dari', true);
	    	$ayah = get_post_meta($post->ID, '_ayah', true);
	    	$ibu = get_post_meta($post->ID, '_ibu', true);
	    	$almt = get_post_meta($post->ID, '_almt', true);
			
			$tangmas = date_i18n("d F Y", strtotime($mas));
		?>
		
		<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><strong><?php echo esc_html( $mail ); ?></strong></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 __( 'Masuk Sekolah : ', '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 __( 'Saat Ini di ', 'prestasi' ); ?><strong>
									    <?php
										    $terms = get_the_terms( $post->ID , 'kelas' );
							                if ( $terms != null ){
									        	foreach( $terms as $term ) {
										        	$term_link = get_term_link( $term, 'kelas');
										        	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 __( 'NISN : ', 'prestasi' ); ?><strong><?php echo esc_html( $nisn ); ?></strong>
							    </div>
							</div>
							
							<div class="clear content_meta">
							    <div class="guru_data">
							    	<div class="clear">
								        <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( $tgl ); ?> </td>
							    			</tr>
								    		<tr>
								    		    <td><strong><?php echo __( 'Agama', 'prestasi' ); ?></strong></td><td><?php echo esc_html( $rel ); ?></td>
								    		</tr>
											<tr>
								    		    <td><strong><?php echo __( 'Alamat', 'prestasi' ); ?></strong></td><td><?php echo esc_html( $add ); ?></td>
								    		</tr>
									        <tr>
							    			    <td><strong><?php echo __( 'Anak Ke ', 'prestasi' ); ?></strong></td><td><?php echo esc_html( $anak ); ?> <?php echo __( 'Dari ', 'prestasi' ); ?><?php echo esc_html( $dari ); ?> <?php echo __( 'Bersaudara', 'prestasi' ); ?></td>
							    			</tr>
											<tr>
								    		    <td><strong><?php echo __( 'Ayah', 'prestasi' ); ?></strong></td><td><?php echo esc_html( $ayah ); ?></td>
								    		</tr>
											<tr>
								    		    <td><strong><?php echo __( 'Ibu', 'prestasi' ); ?></strong></td><td><?php echo esc_html( $ibu ); ?></td>
								    		</tr>
											<tr>
								    		    <td><strong><?php echo __( 'Alamat', 'prestasi' ); ?></strong></td><td><?php echo esc_html( $almt ); ?></td>
								    		</tr>
							    		</table>
							    	</div>
								</div>
							</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>
					</div>
					
				</div>
				
			</div>
		</section>
		
		<?php 
		endwhile; 
	    endif; 
	?>
	
<?php get_footer(); ?>