Last active
October 7, 2016 18:00
-
-
Save ccurtin/1130b0bdc0f5ef6ca576 to your computer and use it in GitHub Desktop.
WORDPRESS pagination for static homepage
This file contains hidden or 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 | |
| // This is necessary for STATIC homepage. | |
| if (get_query_var('paged')) { | |
| $paged = get_query_var('paged'); | |
| } elseif (get_query_var('page')) { | |
| $paged = get_query_var('page'); | |
| } else { | |
| $paged = 1; | |
| } | |
| ?> | |
| <?php | |
| $args = array('posts_per_page' => 4, 'post_type' => 'post', 'paged' => $paged); | |
| query_posts($args); | |
| if (have_posts()): | |
| while (have_posts()): | |
| the_post(); | |
| echo '<div class="item grid-6">'; | |
| get_template_part('/inc/formate/content-fullThumb'); | |
| echo '</div>'; | |
| endwhile; | |
| else: | |
| get_template_part('content', 'none'); | |
| endif; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment