Posts navigation with query of attachments
-
I’ve scavenged code from these forums and elsewhere to query only attachments for display on my Photos Page, a static Page using a custom theme template that is not my home page or my main index page.
I used Kafkaesqui’s technique that is supposed to paginate the queried posts and recognize the navigation links, but each paginated page displays the same attachments, instead of the previous or next in the set.
How can I correct this?
<?php $limit = get_option('posts_per_page'); $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts('showposts=' . $limit . '&paged=' . $paged . '&post_type=attachment&post_status=inherit&paged=$page'); $wp_query->is_archive = true; $wp_query->is_home = false; while (have_posts()) : the_post(); ?> ... <?php endwhile; ?> <?php next_posts_link('« Older photos') ?> <?php previous_posts_link('Newer photos »') ?>
- The topic ‘Posts navigation with query of attachments’ is closed to new replies.