Skip to content

Instantly share code, notes, and snippets.

@oblik
Created July 8, 2013 06:59
Show Gist options
  • Save oblik/5946741 to your computer and use it in GitHub Desktop.
Save oblik/5946741 to your computer and use it in GitHub Desktop.
Custom Queries
<section class="home_blog">
<h2>Derni&egrave;re actualit&eacute;</h2>
<?php $query = new WP_Query( array(
'post_type' => 'post',
'orderby' => 'date',
'posts_per_page' => 1
) );
while ($query->have_posts()) : $query->the_post();
$thumb = get_post_thumbnail_id();
if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) {
$image = vt_resize( $thumb, '', 120, 120, true );
}
global $post;
$date_debut= get_post_meta( $post->ID, '_metabox_agenda_debut', true );
?>
<div class="home_evenements_item">
<a class="home_evenements_item_photo" href="<?php the_permalink(); ?>"><img src="<?php echo $image[url]; ?>" alt="<?php the_title(); ?>" /></a>
<p class='date_evenement'><?php the_time('j F Y'); ?> | <?php the_author() ?></p>
<h3><a class="home_evenements_item_titre" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="home_evenements_item_excerpt"><?php the_excerpt(''); ?></div>
<div>
<?php endwhile; ?>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment