- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘Other’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hi,
I made extensive use of custom post types in my new site, however, I can’t get pagination to work with it, can you please, help?
Many thanks,
Like so:
@Luminated;
Thank you for your help, however I am not sure how to integrate this with my code.
Here is my code,
$loop = new WP_Query( array( 'post_type' => 'doctors', 'posts_per_page' => 10 ) ); ?>
have_posts() ) : $loop->the_post(); ?>
Many thanks,
If you want to list custom posts with of type “doctors”, then copy the file archive.php and rename it to archive-doctors.php. If the custom post type has archives enabled, you should then be able to see them at http://www.yoursite.com/doctors and it should use the same pagination functionality as other blog posts (meaning, same number of posts per page).
In essence, when you go to http://www.yoursite.com/%5Bcustom post type name]/, WordPress will look for a file with the name archive-[custom post type name].php and use that as the template.
Further reading: http://codex.wordpress.org/Template_Hierarchy and definitely this graphic: http://codex.wordpress.org/File:Template_Hierarchy.png