category.php 1.66 KB
Newer Older
agnez's avatar
agnez committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
<?php
/**
 * The template for displaying Archive pages.
 *
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package multipurpose blog
 */

get_header();?>	
<div class="container">
	<h1 class="page-title"><?php single_cat_title();?></h1>
	<div class="row">
		<?php if ( have_posts() ) :
			/* Start the Loop */          
			while ( have_posts() ) : the_post();?>
			<div class="col-md-4 col-sm-4"> 
				<div id="post-<?php the_ID(); ?>" <?php post_class('inner-service'); ?>>    
					<h3 class="section-title"><a href="<?php echo esc_url( get_permalink() ); ?>" title="<?php the_title_attribute(); ?>"><?php the_title();?></a></h3>
<?php 
// TODO trouver comment afficher date uniquement si page cat 1
					if(has_post_thumbnail()) {
						$thumb_img = get_post_meta( get_post_thumbnail_id() );
						$img_alt = get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
						the_post_thumbnail( 'medium', array( 'alt' => $img_alt ) );
						$img_legende = get_post(get_post_thumbnail_id())->post_excerpt;
						if(!empty($img_legende)){
							echo '<div class="legende">' . $img_legende . '</div>';
						}						
						$img_description = get_post(get_post_thumbnail_id())->post_content;
						if(!empty($img_description)){
							echo '<div class="description">' . $img_description . '</div>';
						}
					}
					if(!has_post_thumbnail()) { 
						get_template_part( 'template-parts/formatview',get_post_format() );
					}?>
				</div>
			</div><?php           
			endwhile;
			else :
				get_template_part( 'no-results' ); 
			endif; ?>            
	</div>
	<div class="clearfix">
</div>
<?php get_footer(); ?>