numberposts not responding to wp_reset_postdata()

@Milo’s answer worked perfectly (see comment above). if (in_array($post->ID, $do_not_duplicate)) continue; meant that duplicate posts were still being counted in the loop, though not being displayed. To fix, remove this line, and exclude duplicate posts from the query with this argument: ‘post__not_in’ => $do_not_duplicate. Thank you @Milo for your swift and succinct response.

offset and max_num_pages in pagination gallery

If you want max_num_pages, you need to use WP_Query instead of get_posts. You can then use $your_query_object->max_num_pages in your code. offset and paged don’t work together, because both of them ultimately set LIMIT in the MySQL query. offset query parameter will always override paged. If you want to offset the results, you need to do … Read more

Create a hierarchical loop at predefined markup requirements

I was able to figure it out myself, here is the code: <div id=”fullpage”> <?php //for each category, show 5 posts $cat_args=array( ‘orderby’ => ‘name’, ‘order’ => ‘desc’ ); $categories=get_categories($cat_args); foreach($categories as $category) { $args=array( ‘showposts’ => 5, ‘category__in’ => array($category->term_id), ); $posts=get_posts($args); if ($posts) { echo ‘<section class=”vertical-scrolling” data-anchor=”‘ . $category->name.'”>’; foreach($posts as $post) … Read more