Custom post type pagination on homepage
-
Hi,
I’m having trouble getting the pagination of posts to work on a frontpage. It’s pagination of a custom post type called “event”.
I use this (taken from codex) en this should support frontpage:
if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); } elseif ( get_query_var( 'page' ) ) { $paged = get_query_var( 'page' ); } else { $paged = 1; }
My query:
$my_args = array( 'post_type' => 'event', 'paged' => $paged ); $my_query = new WP_Query( $my_args );
And my navigation is:
get_next_posts_link( __( 'Next »' ), $my_query->max_num_pages ); get_previous_posts_link( __( '« Previous' ) );
I can navigate to page 2 (only).. but the same events are displayed there. So pagination doesn’t work at all. On a regular page pagination works as expected.
What am I doing wrong here?
Guido
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
- The topic ‘Custom post type pagination on homepage’ is closed to new replies.