You can use
$item_nr = $query->current_post;
to give you the position within the loop (starts from 0
).
If you need the first item to start with 1
, you can use:
$item_nr = $query->current_post;
$item_nr++;
Total number of posts found:
$items_found = $query->found_posts;
Related Posts:
- How to change permalink structure for custom post type and it’s taxonomies?
- Conditional for single-{post-type}.php
- Add Content to Page without shortcodes
- Custom post status and preview
- rewrite get parameter with custom post type
- modify all posts of a category to “no comments allowed”
- How to get_queried_object on multiple objects?
- How to not allow custom roles to edit published custom post types?
- Count number of posts which exist in 2 taxonomies?
- Change permalink structure for custom post type
- How can I add columns to custom post tables
- wordpress 3.4 template files in subdirectories
- Help splitting a custom post type archive into “past” and “upcoming”
- Remove duplicated values from a loop
- Count all comments of a custom post type
- Custom fields in Permalinks?
- Conditional tags don’t work
- How can I create a custom meta box to add an mp4 video to a page?
- Add/Remove current_page_parent class
- Pull a post based on a meta value in a custom post type
- Dynamic page outside WordPress
- Custom post type permalinks
- Importing posts from XML into custom post type
- Use different taxonomies in different custom post types’ permalinks?
- Exclude Post Type from Jetpack Infinite Scroll
- Search Custom Post Type & Taxonomies
- Help need making decision. Ads rotating site on wordpress
- Categories of custom taxonomy don’t show any posts
- Can a Custom Taxonomy be named “category” like normal Posts?
- How to use terms from the same custom taxonomy in different roles in a custom post type?
- Able to edit custom post, but unable to create new custom post when within submenu. What capability is missing?
- How to import a custom MySQL DB table into a WordPress custom post type
- Shortcode to display Staff post type based on Location post type and Specialty post type
- Add custom post type drafts to RSS feed
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- Foreach inside shortcode not working as planned
- cutsom posts 404ing
- Associating two custom post types
- Save Multiple Metabox values
- Why does accessing url by category cause issues with post types?
- Query custom post type based on post id and custom field value
- Custom Taxonomy Search result page
- Changing slug of all posts
- Share root slug for Child Page and Custom Post Type (prioritizing child pages over posts)
- Pull in taxonomy field of custom post type in new query
- Use the custom post type archive for taxonomies?
- Apply template by path/slug related to custom post type?
- WP Query results showing posts outside of category ID
- Taxonomy template page not working
- How to count other posts not having specific taxonomy terms?
- How do I disply an array inside a custom post type?
- Is there a way to group specific CPTs under a single dashboard menu item?
- Order users by number of posts (includes custom post type)
- Under What Conditions Can I name my CPT the same as my CPT Page?
- custom post type capabilities – needs to be VERY secure
- Metabox does not show in custom post type
- Need help with Custom Post Types and Taxonomies
- How can I tell if I’m on a custom post type archive page?
- Can’t Get Parent and Child Categories of Custom Taxonomy to Display
- Query all posts under one taxonomy? Why is my code not working?
- Custom rewrite rule takes place AFTER the generic category rule
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- How to Enable Ascending or Descending In WordPress Default Built-in Loop
- How to add Support to show Fullwidth Featured Image of Custom Post Types in WordPress.?
- How to fix the Post Preview Button (CPT & map_meta_cap)
- See if the email exists or not
- Search CPT by tag ids
- Custom post type 404 category page
- Expire post to draft by date-picker custom field
- WP_Query not using custom taxonomy categories on custom post type
- How would i insert a value of custom field from Advaced Custom Field into shortcode generated by Gravity Forms [closed]
- Auto generate excerpt from ACF field on a CPT that does not support excerpt or content
- Combine multiple separate lists into one
- Get Previous Post based on Custom Field Name, for Custom Post Type
- Imported posts for cpt are imported as scheduled, not published [SOLVED]
- Add specific route for Custom Post Type (add/edit…)
- How do I control what template is shown based upon Taxonomy Term?
- How to add a custom button to each field of a Custom Post Types Admin Screen
- Custom Field to post_title
- Stripe multiple transactions
- Custom post type with two templates
- Post Custom & Taxonomy 404 error
- One Post with different content, depending on a Page
- How to add a custom meta box below publish box in CPT that is like publish meta box and can contains html?
- Custom post type and custom taxonomies display
- Custom Post Type – Admin Columns
- Query shopp categories and CPT
- previous_posts_link returns null when querying custom post type
- Custom Post Type Pagination for Bones Theme [duplicate]
- How to scroll through post thumbnails?
- WordPress can only query up to 766
- CPT Archive with parent page
- Adding rewrite rules to Custom Post-type mixed with Taxonomy
- fetch meta fields inside a widget
- Inserting two categories
- Use a Variable in update_post_meta as the $meta_key
- How to manage a bookstore
- How to set up a echo? [closed]
- Issue displaying multiple TinyMCE editors with WPAlchemy
- using jetbooking for multiple custom post types