Created
January 18, 2013 06:15
-
-
Save anonymous/4562711 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template Name: Grid Archive | |
*/ | |
remove_action( 'genesis_loop', 'genesis_do_loop' ); // Remove default loop | |
add_action( 'genesis_loop', 'pure_elegance_do_grid_loop' ); // Do custom loop | |
function pure_elegance_do_grid_loop() { | |
if (function_exists('genesis_grid_loop')) { | |
if (function_exists('genesis_get_custom_field')){ | |
$cat = genesis_get_custom_field('query_args'); // set from custom field when building page | |
} | |
$args = array( | |
'features' => 0, | |
'feature_image_size' => 0, | |
'feature_image_class' => 'alignleft post-image', | |
'feature_content_limit' => 100, | |
'grid_image_size' => 'grid-thumbnail', | |
'grid_image_class' => 'alignleft post-image', | |
'grid_content_limit' => 0, | |
'more' => __( '{Continue reading…}', 'pure-elegance' ), | |
'posts_per_page' => 20, | |
'post_type' => 'post', | |
'cat' => $cat, | |
'paged' => $paged | |
); | |
global $wp_query; | |
$wp_query = new WP_Query( $args ); | |
if( $wp_query->have_posts() ): | |
while( $wp_query->have_posts() ): $wp_query->the_post(); global $post; | |
$classes = 0 == $wp_query->current_post || 0 == $wp_query->current_post % 2 ? 'post page type-page status-publish hentry genesis-grid genesis-grid-odd ' : 'post page type-page status-publish hentry genesis-grid genesis-grid-even '; | |
echo '<div class="' . $classes . '">'; | |
echo '<h2 class="entry-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>'; | |
echo '<div class="entry-content">'; | |
echo '<a href="'.get_permalink().'">'; the_post_thumbnail('grid-thumbnail',array('class' => 'alignleft post-image'));echo '</a>'; | |
echo '</div>'; | |
echo '<div class="post-meta"></div>'; | |
echo '</div>'; | |
endwhile; | |
genesis_posts_nav(); | |
endif; | |
wp_reset_query(); | |
} } | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment