<?php
/**
 * Pengumuman Beranda
 */
?> 
    <?php if ( get_theme_mod('sekolah_type') != "akademi" ) {
	    $ekskuls = 'ekskul';
	} else {
		$ekskuls = 'ukm';
	} ?>
    <div class="outer_extra clear">
	    <div class="home_extra">

        <?php // query
		    $args = array(
			    'post_type' => $ekskuls, 
			    'posts_per_page' => 4, 
				'orderby' => 'rand',
			);
		    query_posts($args);
			?>
			<div class="bot_head"><span class="re_kegiatan <?php echo $ekskuls; ?>"><?php press_re_kegiatan(); ?></span></div>
	            <?php 
				    if (have_posts()) {
						while (have_posts()): the_post();
						    global $post;
						    ?>
							
							<div class="box_extra">
							    <a href="<?php the_permalink() ?>">
									<?php // Featured Image
						                $thumb_id = get_post_thumbnail_id();
						                $thumb_url = wp_get_attachment_image_src($thumb_id,'gals', true);
						                if (has_post_thumbnail()) { 
										    echo '<div class="extra_img" style="background-image: url('. $thumb_url[0] .');"></div>';						
						                } else {
											if ( get_theme_mod('pressthumb_image') != "" ) {
							                	echo '<div class="extra_img" style="background-image: url('. get_theme_mod('pressthumb_image') .');"></div>';	
											} else {
												echo '<div class="extra_img" style="background-image: url('. get_theme_file_uri('images/prestasi.jpg') .');"></div>';
											}
							            }
									?>
								    <div class="extra_text">
									    <h5><?php the_title(); ?></h5>
										<a href="<?php the_permalink() ?>"><span class="re_lihat"><?php press_re_lihat(); ?></span></a>
									</div>
								</a>
							</div>
							
							<?php 
						endwhile;
					} 
				
			wp_reset_query(); 
		?>
		
        </div>
    </div>