-
-
Save jjeaton/5136948 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: Galleries | |
* | |
* @package BE_Gallery | |
* @since 1.0.0 | |
* @link https://github.com/billerickson/BE-Gallery | |
* @author Bill Erickson <[email protected]> | |
* @copyright Copyright (c) 2011, Bill Erickson | |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | |
* | |
*/ | |
// Only use pagination on custom loop | |
remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' ); | |
add_action( 'genesis_after_post_content', 'be_galleries_loop' ); | |
/** | |
* Galleries Loop | |
* | |
*/ | |
function be_galleries_loop() { | |
$args = array( | |
'posts_per_page' => 6, | |
'post_type' => 'post', | |
'paged' => get_query_var( '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 = 'one-third'; | |
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 3 ) | |
$classes .= ' first'; | |
echo '<div class="'. $classes . '"><h2><a href="' . get_permalink() . '">' . get_the_title() . '<br />' . get_the_post_thumbnail( $post->ID, 'be_archive' ) . '</a></h2></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