Skip to content

Instantly share code, notes, and snippets.

@ejntaylor
Created October 12, 2013 09:39
Show Gist options
  • Save ejntaylor/6947974 to your computer and use it in GitHub Desktop.
Save ejntaylor/6947974 to your computer and use it in GitHub Desktop.
Woo Canvas Blog Grid (based on Magazine Blog Grid)
<style>
/* Home - Blog Grid */
.home-blog-grid article {
float: left;
width: 47%;
padding-right: 3%;
}
.home-blog-grid {
overflow-x: auto;
padding: 40px 40px 20px 40px;
}
</style>
<div class="home-blog-grid">
<?php
// Use a custom query to display posts instead of the page content.
$page = get_query_var( 'page' );
$paged = get_query_var( 'paged' );
// Make sure we're on the correct page.
if ( ( $page > $paged ) ) { $paged = $page; }
// Run the query to get the posts.
query_posts( 'post_type=post&posts_per_page=4&suppress_filters=0&paged=' . $paged );
if ( have_posts() ) { $count = 0;
while ( have_posts() ) { the_post(); $count++;
woo_get_template_part( 'content', get_post_type() ); // Get the page content template file, contextually.
}
}
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment