Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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
You can’t perform that action at this time.