I would like to know how I could get the offset of a custom post or its page, outside the get_posts loop.
I developed an external web application which connects to the wordpress blog with JSON API plugin, and show a given posts page using an AJAX request like :
(This will return the nth page of x posts)
This works well, but now I would like to set a link on the wordpress blog "single post" page to this application, like "Show this post in app", with the current page offset as parameter. So I will be able to read this param in the app and get posts of the page containing the post, and highlight this post (sent as parameter).
If I can get the offset, I will be able to show the right page with a modulo operator :
If offset = 22 and count = 10, show page 3 and highlight post n°2
page = Math.ceil(offset / count); post_to_highlight_position = offset % count;
Do you know how I could do that? or if there is a better way to achieve this?