Skip to content

Instantly share code, notes, and snippets.

@florentsorel
Last active August 29, 2015 13:59
Show Gist options
  • Save florentsorel/10981677 to your computer and use it in GitHub Desktop.
Save florentsorel/10981677 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="icon" type="image/png" href="<?php bloginfo('template_url'); ?>/favicon.png?<?php echo filemtime( get_stylesheet_directory() . '/favicon.png'); ?>">
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); echo '?' . filemtime( get_stylesheet_directory() . '/style.css'); ?>" type="text/css" media="screen" />
<link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' rel='stylesheet' type='text/css'>
<?php wp_head(); ?>
</head>
<body>
<div class="wrap">
<div id="container" class="clear"><!-- #container -->
<?php include(locate_template( 'loop.php' )); ?>
<div id="content"><!-- #content -->
<a href="<?php the_permalink(); ?>" class="titre"><?php the_title(); ?></a>
<?php if(has_post_thumbnail()): ?>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'thumbs-small' ); ?></a>
<?php else: ?>
<a href="<?php the_permalink(); ?>"><img src="http://placehold.it/286x132" /></a>
<?php endif; ?>
<?php $articles = new WP_Query(array('posts_per_page' => 5)); ?>
<?php if($articles->have_posts()): $i = 0; ?>
<?php $str = '<div class="left">'; ?>
<?php while($articles->have_posts()): $articles->the_post(); ?>
<?php
$add = 'class="post"';
ob_start(); get_template_part('item');
$content = ob_get_clean();
if($i == 2) {
$add = 'class="post middle"';
}
$str .= '<div '. $add .'>' . $content . '</div>';
if($i == 1 || $i == 2 || $i == 4)
{
$str .= '</div><div class="left">';
}
?>
<?php $i++; endwhile; wp_reset_query(); ?>
<?php echo $str; ?>
<?php endif; ?>
</div><!-- /#content -->
<div id="sidebar">
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment