Forked from anonymous/Genesis Custom Grid Loop
Last active
June 30, 2016 21:44
Revisions
-
billerickson renamed this gist
Jun 30, 2016 . 1 changed file with 5 additions and 17 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,6 @@ 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 @@ -26,29 +25,18 @@ function custom_do_press_loop() { '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>'; -
There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,76 @@ <?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();