Pagination & Custom Post Types
-
So I’m trying to get Custom Post Type UI and WP-PageNavi.
I’m having pagination issue’s though. I keep reading all kinds of different ways to accomplish this without any luck.
Here’s my code:
<?php $loop = new WP_Query( array( 'post_type' => 'web', 'posts_per_page' => 6 ) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> LOOP STUFF HERE <?php endwhile; ?> <?php wp_reset_postdata(); // reset the query ?> <?php wp_pagenavi(): ?>
It all works, except when I try to go to the 2nd page of the page.
Here’s my url when trying to accomplish all this:
https://www.website.com/test/portfolio/web/page/2/
(Is this my prob?)Here’s my code the Custom Post Type UI generates for me:
register_post_type('web', array( 'label' => 'Websites','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'portfolio/web'),'query_var' => true,'menu_position' => 4,'supports' => array('title','editor','excerpt','custom-fields','thumbnail',),'labels' => array ( 'name' => 'Websites', 'singular_name' => 'Website', 'menu_name' => 'Websites', 'add_new' => 'Add Website', 'add_new_item' => 'Add New Website', 'edit' => 'Edit', 'edit_item' => 'Edit Website', 'new_item' => 'New Website', 'view' => 'View Website', 'view_item' => 'View Website', 'search_items' => 'Search Websites', 'not_found' => 'No Websites Found', 'not_found_in_trash' => 'No Websites Found in Trash', 'parent' => 'Parent Website', ),) );
Thoughts? ANYTHING would help.
Thanks!
- The topic ‘Pagination & Custom Post Types’ is closed to new replies.