-
-
Save jamiemitchell/6987887 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 */ | |
| /** | |
| * Category Loop | |
| * | |
| */ | |
| function be_category_loop() { | |
| global $post, $wp_query; | |
| $args = array( | |
| 'posts_per_page' => 20, | |
| 'post_type' => 'post', | |
| 'paged' => get_query_var( 'paged' ), | |
| 'cat' => (int) get_post_meta( $post->ID, 'query_args', true ), | |
| ); | |
| $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 one-half first' : 'post one-half'; | |
| 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().'">' . get_the_post_thumbnail( null, 'grid-thumbnail' ) . '</a>'; | |
| echo '</div>'; | |
| echo '</div>'; | |
| endwhile; | |
| genesis_posts_nav(); | |
| endif; | |
| wp_reset_query(); | |
| } | |
| add_action( 'genesis_loop', 'be_category_loop' ); | |
| remove_action( 'genesis_loop', 'genesis_do_loop' ); | |
| genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment