<?php 
	$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
	query_posts( array( 
		'post_type' => 'agenda', 
		'paged' => $paged, 
		'meta_key' => '_minus',
		'meta_query' => array(
			array(
				'key' => '_minus',
				'compare' => '>='
				)
			),
		'orderby' => 'meta_value',
		'order' => 'DESC'
		) 
	); 
    if (have_posts()):
	    while (have_posts()): the_post(); 
			global $post;
			
			$tevent = get_post_meta($post->ID, '_tevent', true);
			$minus = strtotime(get_post_meta($post->ID, '_tevent', true));
			$lokasi = get_post_meta($post->ID, '_lokasi', true);
			$koordinator = get_post_meta($post->ID, '_koordinator', true);
			$telepon = get_post_meta($post->ID, '_telepon', true);
			$jam = get_post_meta($post->ID, '_jam', true);
			$dday = strtotime(date_i18n('d-m-Y H:i'));
			$end = get_post_meta($post->ID, '_tevent', true).' '.get_post_meta($post->ID, '_jam', true);
			$exp = strtotime(date_i18n($end));
			$sisa = $exp-$dday;
			$acara = date_i18n("d F Y", strtotime($tevent));
		
		?>
		
		    <div class="post_loop clear">
			    <div class="post_in">
				
				    <div class="post_inthumb">
					
				    	<a href="<?php the_permalink() ?>">
						    <?php // Featured Image
							    if (has_post_thumbnail()) { 
									the_post_thumbnail('news'); 
								} else {
									if ( get_theme_mod('pressthumb_image') != "" ) {
							            echo '<img src="'. get_theme_mod('pressthumb_image') .'" />';	
									} else {
										echo '<img src="'. get_theme_file_uri('images/prestasi.jpg') .'" />';
									}
								}
							?>
						</a>
						
				        <?php if ( $sisa < 0 ) { 
						    echo __( '<div class="post_inpublish expired"><span>Acara Sudah Lewat</span></div>', 'prestasi' ); 
						} else { 
							printf(__('<div class="post_inpublish"><span>%1s - %2s</span></div>', 'prestasi'), esc_html($acara), esc_html($jam) ); 
						} ?>
						
			        </div>
					
					<div class="post_inmeta clear">
					
				    	<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
			        	<div class="post_inexcerpt">
			            	<?php echo smart_excerpt(get_the_excerpt(), 20); ?>
			        	</div>
						
			    	</div>
					
				</div>
			</div>
			
		<?php endwhile; 
    endif; 
	
	wp_reset_query(); 
	
?>
