In your case, count would be offset + current_post:
$my_query = new WP_Query(
array(
'post_type' => 'colors',
'posts_per_page' => 5,
'offset' => 2
)
);
if ( $my_query->have_posts() ) :
while ( $my_query->have_posts() ) :
$my_query->the_post();
echo $my_query->query_vars['offset'] + $my_query->current_post;
the_title();
endwhile;
endif;
wp_reset_postdata();
Related Posts:
- Get the index of post outside the loop
- Most commented / popular posts and offset
- Querying Different Categories in Different Loop With Different Offsets
- myprefix_adjust_offset_pagination’ not found
- Undefined offset: 1
- Offset loop not showing the last post
- How can I create a category landing page followed by pages of posts?
- Different ‘posts_per_page’ setting for first, and rest of the paginated pages?
- WP_Query offset argument does not work
- Using Offset in Custom Post Type Query
- How to adjust found_posts so that it accounts for offset and pagination
- Two custom loops, pagination, offset
- Related Posts loop – offset
- WP Query with offset breaks wp_pagenavi or any pagination
- Specific Loop For 2 Within Each
- Exclude first 5 posts of specific categories in the main loop
- Custom query, works, but I get a “Notice: Undefined offset: 0…”
- WP_Query: offset ignored when posts_per_page is -1?
- Offset Page Loops and Pagination
- How select a specific query when setting offset?
- How to use offset in WP_Query
- How can I fix: “Notice: Undefined offset: 0”?
- WP_Query, pre_get_posts and offset
- Offset a post in the loop, with using PageNavi Plug-in
- Missing image in gallery shortcode in custom feed
- Blog page pagination is not working after using the offset argument
- Exclude the first ‘n’ number of posts of a tag from home page?
- Comments offset
- WP_Query with offset and ‘orderby’ => ‘rand’, offset not working
- How do I rewrite this loop as a new WP_Query style-loop?
- WP_Query arguments order
- Creating two loops based on different logic
- Get post offset/posts page offset in single post page (outside the loop)
- Loop Offset for tag based “Related Posts”
- WP_Query – Adding “offset” posts to the end of the loop
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Apply query arguments after the nth post
- AJAX Breaking Offset Argument In WP Query
- Page navigation doesn’t seem to work when I add offset?
- WP_Query offset is returning post from prevois loop
- Exclude some posts from displaying in wp_query based on some condition
- Offset WP_Query by negative 1
- Offset posts with random order
- Calling two images at a time? A better way?
- Offset Loop by 1 , Limit next loop to 1 (Most Recent) Post
- Keeping get_posts’ offset and is_paged() synchronized
- Offset for Loop
- How do I add a timezone offset to this query?
- Manipulated offset and pagination, can’t display last post anymore
- Undefined offset: 0 in WordPress after latest version upgrade [closed]
- setting offset to category number in archive page
- Pagination Not Working When Used With WP_Query() `offset` Property
- Timezone for Plugin
- Undefined index when saved to options
- Best practice and technology to Offset anchor links
- Jquery scroll animate offset asynchronous
- Style first 3 posts differently and use a 2nd loop to get rest of posts / offset and pagination broken
- Using something else instead of using 9 wp_query
- Featured Image as Background with Offset
- WordPress WP_Query offset parameter not working with search parameter
- Querying Multiple Categories With Different Offsets
- wordpress category.php query for featured news item, broken pagination and repeating posts
- How to remove post duplicate when using query_posts(‘offset=1’)