<?php 
    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
	query_posts( array( 
		'post_type' => 'materi', 
		'paged' => $paged, 
		'posts_per_page' => 100,
		) 
	);
    if (have_posts()): ?>	
	
		<div class="clear soal_kumpulan">
		    <?php 
				while (have_posts()): the_post(); 
				    global $post;
					$materi_soal = get_post_meta($post->ID, 'materi_soal', true);
					?>
					
					<div class="clear soal_box">
					    <div class="per_materi">
							<div class="per_count">
								<?php
								    if (is_array($materi_soal)) { 
										$total_soal = count($materi_soal);
									    echo $total_soal;
									}
								?>
							</div>
							<div class="per_span"><?php _e('SOAL'); ?></div>
						</div>
						<div class="det_materi">
							<h4>
							    <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
							</h4>
							<div class="press_artikel press_mat">
							    <?php echo smart_excerpt(get_the_excerpt(), 60); ?>
							</div>
							<div class="clear">
							    <?php
							        $terms = get_the_terms( $post->ID , 'mapel' );
							        if ( $terms != null ){
										foreach( $terms as $term ) {
											$term_link = get_term_link( $term, 'mapel');
											echo '<a class="det_mapel" href="' . $term_link . '">' . $term->name . '</a> ';
											unset($term); 
										} 
									} 
								?> 
							    </div>
								<div class="mat_author">
								    <div class="mat_by">
									    <?php printf(__('Dibuat : %s', 'prestasi'), get_the_time('j F Y H:i')); ?><br/>
								    	<?php printf(__('Oleh %s', 'prestasi'), get_the_author()); ?>
									</div>
									<div class="mat_avatar">
								    	<?php if (get_the_author_meta( 'user_meta_image' )) { ?>
								    	    <img src="<?php echo esc_url( get_the_author_meta( 'user_meta_image' ) ); ?>"/>
								    	<?php } else { ?>
								    	    <?php echo get_avatar( get_the_author_meta( 'ID' ) , 40 ); ?>
								    	<?php } ?>
									</div>
								</div>
						    </div>
						</div>
						<?php 
					endwhile; 
				?>
				
		</div>
			
		<?php  
    endif; 
	get_template_part('archive/pagination'); 
	wp_reset_query(); 
	
?>