Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Genesis Front Page Custom Loop Fix
<?php
add_action( 'genesis_after_entry', 'homepage_post_loop' );
function homepage_post_loop() {
global $wp_query;
global $paged;
$paged = get_query_var('page');
$args = array(
'posts_per_page' => 10,
'post_type' => 'post',
'paged' => $paged,
);
$wp_query = new WP_Query( $args );
if( $wp_query->have_posts() ):
echo '<div class="container">';
echo '<div class="two-thirds first">';
do_action( 'genesis_before_while' );
while( $wp_query->have_posts() ): $wp_query->the_post(); global $post;
// if(has_post_thumbnail(get_the_ID())){
// $img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'attr' => array( 'class' => 'post-image' ) ) );
// printf( '<a href="%s" title="%s" class="featured-image">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), $img );
// }
do_action( 'genesis_before_entry' );
printf( '<article %s>', genesis_attr( 'entry' ) );
do_action( 'genesis_entry_header' );
do_action( 'genesis_before_entry_content' );
printf( '<div %s>', genesis_attr( 'entry-content' ) );
do_action( 'genesis_entry_content' );
echo '</div>';
do_action( 'genesis_after_entry_content' );
do_action( 'genesis_entry_footer' );
echo '</article>';
//do_action( 'genesis_after_entry' );
endwhile;
do_action( 'genesis_after_while' );
genesis_posts_nav();
echo '</div>';
echo '<div class="one-third">';
get_sidebar();
echo '</div>';
echo '</div></div>';
endif;
wp_reset_query();
}
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.