Last active
April 26, 2019 12:32
-
-
Save stefanledin/6b819b082ac842ed73699409facf75df 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: 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