want to get all post from all category with pagination
-
i have 50 categories and every category have 100 post. i have a page template, on this page i want to show category with 5-5 posts but in pagination.
I have used this below code but no any pagination and no any post found only category names coming.$args = array( 'type' => 'post', 'child_of' => 0, 'parent' => '', 'orderby' => 'ID', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => 'category', 'pad_counts' => false ); $categories = get_categories($args); foreach($categories as $category){ $catId[] = $category->term_id; } $catId_comma_separated = implode(",", $catId); $myposts = get_posts(array('numberposts' => 5, 'offset' => 0, 'cat' => $catId_comma_separated, 'post_status'=>'publish', 'order'=>'ASC' )); query_posts( "cat = $catId_comma_separated"); while ( have_posts() ) : the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile; // Reset Query wp_reset_query(); custom_pagination();
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘want to get all post from all category with pagination’ is closed to new replies.