Pagination in Attachments query
-
Hello
I’m making page template which queriess its attachments and displays them one by one, 8 on page. I’d like to add “next page” button to it, but all wp_link_pages and other functions seem not to work.
My query code:<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $attachments = array( 'post_type' => 'attachment', 'post_status' => array('publish', 'draft', 'inherit'), 'numberposts' => -1, 'posts_per_page' => 8, 'paged' => $paged, ); query_posts($attachments); if (have_posts()) : while (have_posts()) : the_post(); ?> <?php $attachments = get_posts( $args ); ?> <?php echo wp_get_attachment_image( $attachment->ID, 'gallery-thumb' ); ?> <?php endwhile; else: ?> NO ATTACHMENTS <?php endif; ?> <?php echo paginate_links(); ?>
Why it’s not working? Maybe I’m using wrong function for displaying next page link?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Pagination in Attachments query’ is closed to new replies.