Good afternoon all,
I have a custom taxonomy called 'Gallery' and a have created a new page template to pull in and paginate all posts in the 'gallery' taxonomy.
This works fine (as a page), however I would like to set this page as the WordPress static 'Front page'.
When I set this page template as the 'Front page' the pagination no longer works. I have tried many solutions today and would really appreciate some help on this one!
Any help/tips massively appreciated!
Thanks.
My Code:
<?php
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} else if ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
$args = array(
'post_type' => 'gallery',
'paged' => $paged,
'orderby' => 'menu_order',
'order' => 'DESC'
);
query_posts( $args );
if ( have_posts()) : while( have_posts() ) : the_post(); ?>
<!-- List Posts -->
<?php endwhile; ?>
<nav>
<?php previous_posts_link( __( 'Previous', 'framework' ) ); ?>
<?php next_posts_link( __( 'Next', 'framework' ) ); ?>
</nav>
<?php else : ?>
<!-- No Posts -->
<?php endif; ?>
<?php wp_reset_postdata(); ?>
EDIT:
If I add global $paged; before the if statements it does works perfectly. Could anyone educate me on what I was missing?
Also what are the performance implications (if any) of calling global $paged; on the homepage?