Skip to content

Instantly share code, notes, and snippets.

@billerickson
Forked from anonymous/Genesis Custom Grid Loop
Last active June 30, 2016 21:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/b7d40aedf056b4542a28753b5e9db3c7 to your computer and use it in GitHub Desktop.
Save billerickson/b7d40aedf056b4542a28753b5e9db3c7 to your computer and use it in GitHub Desktop.
<?php
/**
* Template Name: Residential Portfolio
*
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_press_loop' ); // Add custom loop
function custom_do_press_loop() {
//Add Post Class Filter
echo '<div class="page hentry entry">';
echo '<h1 class="entry-title">Residential</h1>';
echo '<div class="entry-content">';
$args = array(
'post_type' => 'project',
'types' => 'residential',
'posts_per_page' => 100,
'orderby' => 'date',
'order' => 'DSC',
'post_class' => $classes,
);
$loop = new WP_Query( $args );
if( $loop->have_posts() ):
while( $loop->have_posts() ): $loop->the_post(); global $post;
$classes = array( 'one-third' );
if( 0 == $loop->current_post % 3 )
$classes[] = 'first';
echo '<div class="' . implode( ' ', get_post_class( $classes ) ) . '">';
echo '<a href="' .get_permalink(). '">'. get_the_post_thumbnail( $id, array( 500, 500) ).'</a>';
echo '<h3 class="press-title"><a href="' .get_permalink(). '">' . get_the_title() . '</a></h3>';
echo '</div>';
endwhile;
endif;
echo '</div><!-- end .entry-content -->';
echo '</div><!-- end .page .hentry .entry -->';
}
/** Remove Post Info */
remove_action('genesis_before_post_content','genesis_post_info');
remove_action('genesis_after_post_content','genesis_post_meta');
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment