If the post order reflect the publishing date (and note that publishing date also takes into account hour, minute and second of publication) than is pretty easy to get the order, using a query that return only post ids and then array_search
to find current post id index:
$query = new WP_Query( array(
'TAXONOMY' => 'TAXONOMY TERM',
'posts_per_page' => -1,
'post_status' => 'publish',
'orderby' => 'date', // be sure posts are ordered by date
'order' => 'ASC', // be sure order is ascending
'fields' => 'ids' // get only post ids
));
global $post; // current post object
$i = array_search( $post->ID, $query->posts ) + 1; // add 1 because array are 0-based
echo "Post {$i} / {$query->post_count} in TAXONOMY TERM";
Related Posts:
- WP_Query orderby date not working
- Get Recent Posts by Date in Multisite
- WordPress Custom Query to show posts from last x years
- How can I hide posts that are over 2 years old
- Date query not inclusive despite parameter being true
- Use meta_query to display events by date in custom field
- Ordering by meta_value AND date NOT WORKING with wp_query
- How to show recent and upcoming birthdays using meta_query
- Meta Query for specific months
- WP_Query meta_query >= date
- Complex date range with WP_Query and BETWEEN
- Comparing dates in custom field
- How to display upcoming events by dat with Modern Events Calendar Lite
- Orderby ASC changes to DESC in WP_Query
- Complex WP_Query order request: DESC by day, but then ASC by time
- WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
- Taxonomy and Date in same query?
- Shortcode for latest -not expired- posts
- date_query seems to be ignored by wp_query
- WP Group posts by year(desc) > month(desc) > date(asc)
- WordPress Custom Search Form Displaying Unexpected Results
- Filtering posts by archive showing all years
- Ordering posts by custom field and grouped by month
- Limit loop to future events
- How to show list of posts with custom field value (a date) that are coming soon
- Show single posts date, in a page of posts
- Added Date Filter To Popular Posts Query
- Comparing Meta Field date in WPQuery using Meta_Query?
- How to get only present and past posts with post_date
- WP Query for all events prior to current date
- Problem with my loops
- Sort posts on custom field AND after that sort on date?
- Get posts by birthday
- Year based WP Query
- Get post closest to today
- Query custom post type by date field only working when two posts match the query
- Get posts from similar time as current post
- Divide WP_Query posts by date & post type
- Query Posts by date range with fixed beginning and end
- Issue with sorting by post date and custom post type
- Get posts that were most recently tagged
- WP_Query sort by ACF date field (newest first) with blank dates first
- How to display only posts from the last day with posts published?
- WP_Query filtering in ACF field containing dates
- When should you use WP_Query vs query_posts() vs get_posts()?
- When to use WP_query(), query_posts() and pre_get_posts
- WP_Query by just the id?
- Meta_query compare operator explanation
- WP_Query with “post_title LIKE ‘something%'”?
- wp query to get child pages of current page
- How to get an array of post data from wp_query result?
- How to get post id of static front page?
- meta_query with meta values as serialize arrays
- How to only display posts whose meta_value field is not empty?
- Get post ids from WP_Query?
- Pagination when using wp_query?
- Exclude post ID from wp_query
- How to print the excuted sql right after its execution
- How to extend WP_Query to include custom table in query?
- How to store and receive variables in WP sessions?
- Should I use Pre Get Posts or WP_Query
- How can i retrieve default post per page value? from settings->reading. And total number of posts?
- Nested meta_query with multiple relation keys
- Is it necessary to use wp_reset_query() in a WP_Query call?
- Can I force WP_Query to return no results?
- Can wp_query return posts meta in a single request?
- Using pre_get_posts with WP_Query
- Find out total number of pages in global query on archive page?
- WP_Query + random
- Resetting post data to previous loop in nested loops
- order by numeric value for meta value
- numberposts? showposts? posts_per_page?
- $GLOBALS[‘wp_the_query’] vs global $wp_query
- Broken? WP_Query and “attachment” as a post type
- Some doubts about how the main query and the custom query works in this custom theme?
- Order by multiple meta key and meta value [closed]
- Post_count only shows the number of results per page
- Page template query with WP_Query
- meta_query ‘compare’ => ‘IN’ not working
- Query posts only with featured image
- Wp get all the sub pages of the parent using wp query
- What is appropriate flow for custom data from URL in WP_Query?
- How to display page content in a page template?
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- How to merge two queries together
- Posts with at least 3 tags of a list of tags
- Get post count of current loop when using multiple queries on one page
- why ignore_sticky_posts in sticky post query
- Wp_redirect and sending variables
- Multiple relationship for multiple tax_query in WP_Query
- How do I get posts that have a thumbnail in WP_Query?
- Multiple WP_Query loops with Pagination
- How do I query for posts by partial meta key?
- Pagination with custom SQL query
- Return only Count from a wp_query request?
- Using a custom WP_Query with get_template_part loop
- Use REGEXP in WP_Query meta_query key
- Why is the loop not empty on some 404s?
- WP_Query orderby post__in remains ineffective in the Loop [closed]
- WP Query Args – Title or Meta Value