Can't get pagination to work, gallery made from custom post types inside a post.
-
Hi all. I have a wp problem that is driving me nuts and I have to get the job done by monday, so any help would be greatly appreciated. I dabble in php but never learned it properly, and now it’s showing ??
The thing is, I have a working query inside the post template, showing five elements. This works well, and it’s paginated, so if I add
&paged=2
to the url in the browser it takes me to the next page of elements, no problem. The problem is, I can’t for the life of me get the pagination to show. The code is as follows:<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'posts_per_page' => 5, 'paged' => $paged, 'post_status' => null ); $attachments = get_posts($args); ?>
And then, to show the pagination:
<div class="pagination"> <?php paginate_links(); ?> </div>
Any idea what I’m doing wrong? Thanks a lot.
- The topic ‘Can't get pagination to work, gallery made from custom post types inside a post.’ is closed to new replies.