-
-
Save billerickson/b7d40aedf056b4542a28753b5e9db3c7 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: Residential Portfolio | |
* | |
*/ | |
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop | |
add_action( 'genesis_loop', 'custom_do_press_loop' ); // Add custom loop | |
add_filter( 'post_class', 'be_archive_post_class' ); | |
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, | |
); | |
function be_archive_post_class( $classes ) { | |
global $wp_query; | |
if( ! $wp_query->is_main_query() ) | |
return $classes; | |
$classes[] = 'one-third'; | |
if( 0 == $wp_query->current_post % 3 ) | |
$classes[] = 'first'; | |
return $classes; | |
} | |
$loop = new WP_Query( $args ); | |
if( $loop->have_posts() ): | |
while( $loop->have_posts() ): $loop->the_post(); global $post; | |
echo '<div ' ; | |
post_class( $classes ); | |
echo'>'; | |
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