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 49 50 51 52 53 54 55
| <?php
/*
Template Name: Home
*/
?>
<?php get_header(); ?>
<div id="home">
<div id="main-actu" role="main">
<article id="a-la-une">
<?php
$recentPosts = new WP_Query();
$sticky = get_option('sticky_posts');
$args = array(
'showposts' => 5,
'post__in' => $sticky,
'caller_get_posts' => 1,
'orderby' => 'date',
);
$recentPosts->query($args);
while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<?php if ( has_post_thumbnail()) : ?>
<div class="image-home"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail('homecustomesize'); ?>
</a> </div>
<div id="a-la-une-copies">
<h2>
<?php the_title(); ?>
</h2>
<span class="min-data">
<?php the_time('d m'); ?>
-
<?php $category = get_the_category(); if($category[0]){echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>'; } ?>
-
<?php comments_number( '0 commentaire', '1 commentaire', '% commentaires' ); ?>
- De <?php the_author_posts_link(); ?>
</span>
<?php the_excerpt(); ?>
<?php endif; ?>
<?php endwhile; ?>
</div>
<!-- <a href="http://wpchannel.com/afficher-sticky-posts-wordpress/" target="_blank">http://wpchannel.com/afficher-sticky-posts-wordpress/</a> -->
</article>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Noojaman') ) : endif; ?>
</div>
<!-- #main-actu -->
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?> |
Partager