pagination with get_posts
-
Hello, I’m trying to use this plugin with get_posts but it is not working.
The code I’m using:$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; $args = array('post_type'=> 'custom_post','posts_per_page' => 5, 'paged' => $paged,); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); //content echo easy_wp_pagenavigation( $myposts );
Can you please tell what’s wrong?
It is working fine if I use
$myposts = new WP_Query( $args ); while ( $myposts->have_posts() ) : $myposts->the_post();
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘pagination with get_posts’ is closed to new replies.