Skip to content

Instantly share code, notes, and snippets.

@stefanledin
Last active April 26, 2019 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanledin/6b819b082ac842ed73699409facf75df to your computer and use it in GitHub Desktop.
Save stefanledin/6b819b082ac842ed73699409facf75df to your computer and use it in GitHub Desktop.
<?php
/*
Template name: My custom archive page
*/
$posts = new WP_Query( array(
'post_type' => 'articles',
'posts_per_page' => 1,
'paged' => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1
) );
if ( $posts->have_posts() ) : foreach ( $posts->get_posts() as $post ) : setup_postdata( $post );
// Loop through the posts
endforeach; wp_reset_postdata();
// Pagination
echo paginate_links();
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment