Skip to content

Instantly share code, notes, and snippets.

@captprice26
Created October 26, 2016 06:01
Show Gist options
  • Save captprice26/03b97819cf995c6684345b7cdb9adb4e to your computer and use it in GitHub Desktop.
Save captprice26/03b97819cf995c6684345b7cdb9adb4e to your computer and use it in GitHub Desktop.
For Wordpress - Genesis Theme Custom post loop with pagination
<?php
/* Template Name: Test */
/**
* Genesis custom loop
*/
function be_custom_loop() {
global $post;
// arguments, adjust as needed
$args = array(
'post_type' => 'post',
'posts_per_page' => 1,
'post_status' => 'publish',
'paged' => get_query_var( 'paged' )
);
/*
global $wp_query;
$wp_query = new WP_Query( $args );
if ( have_posts() ) :
echo '<ul>';
while ( have_posts() ) : the_post();
echo '<li>' . get_the_title() . '</li>';
endwhile;
echo '</ul>';
do_action( 'genesis_after_endwhile' );
endif;
wp_reset_query();
}
add_action( 'genesis_loop', 'be_custom_loop' );
remove_action( 'genesis_loop', 'genesis_do_loop' );
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment