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
- Order by multiple meta key and meta value [closed]
- Order by optional meta key?
- WP_query to get the first two latest posts, then another loop to get the next three
- Why is WP_Query not working with category_name?
- ‘Trying to get property of non-object’ when using WP_Query with ‘fields’ => ‘ids’
- Execute a large WP_Query with many “AND” Meta_Queries?
- Get attachment by slug
- RSS feed with specific keyword
- Get All IDs Of A Post Type Using WP_Query
- Multiple endpoints in one URL
- How to query using a combination of custom_field values?
- Show one post per author and limit query to 8 posts
- Get term by custom term meta and taxonomy
- SELECT * FROM $wpdb->posts WHERE ID > 160
- How to show the posts of some category first, and then all other
- Explanation of WP_Query
- Paginated HTML Sitemap
- How to get posts on a specific date – WP Query
- WP_Query no posts with tax_query
- WP_Query with Metavalue
- My Main Query Modification is Messing up my dynamic main – why?
- need to exclude APP_TAX_STORE => $term->slug
- Search for multiple tags?
- paging in WP_Query on static page
- WP_Query() and get_posts() can’t handle over a thousand posts?
- Query by multiple meta elements not seeming to work – wordpress is timing out
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- Post loop for all taxonomy terms
- How to get all post except particular category without breaking the paging
- How do I rewrite this loop as a new WP_Query style-loop?
- ACF Query Structure
- exclude product with available tag
- relation OR instead of AND – Filtered term ID’s in loop
- How to get specific string in explode array?
- filter posts by meta key with pagination
- Oxygen Repeater Advanced Query
- Use dedicated functions
- Pagination not working on archive.php template?
- Save large WP_Query to transient === false
- How to show specify category template for both parent and child category
- WP_Term_Query->get_terms() very slow query for WordPress filter
- WordPress search page pagination displaying but not functional
- Get all wp_users sort by metakey
- query all posts published by certain user id
- Query custom meta value – post view and date meta
- modifying the loop multiple times with arguments passed through ajax to wp_query
- WP_Query – show posts where meta value and user_email match
- WP_Query causing links to not work
- Orderby Date and Category
- Pagination for custom query throws 404 errors on last pages [duplicate]
- Order posts by custom column using pre_get_posts
- Need help setting up a search form for wordpress [duplicate]
- Including ‘cat’ => $cat breaks meta_query
- problem in query_vars parameters
- Limit Tags display and ad Drop Down Menu
- Add banner after the third post [closed]
- new WP_Query with order args – no more distinction between categories
- How to make OR condition in WP_Query