I don’t think that you can get an offset of the page outside of the loop, since it will be out of the context. Offset may vary depending on the arguments you are using to get posts for the loop.
Easiest solution will be to calculate offset in the app. You will need to pass post_id as an attribute and then loop through all the posts obtained by ?json=get_posts&orderby=date&order=desc&count=x&page=n
and compare their IDs to the one you got as an attribute.
Hope it makes sense.
Related Posts:
- Jquery Slider for profile template
- Is it necessary to reset the query after using get_posts()?
- AJAX with loop filtering categories
- Using the Loop to show all levels of subpages under a parent page? Halfway there
- Child Pages Loop
- Get post by page name or slug
- Loop that displays PARENT PAGE & CHILD PAGE & outputs GRANDCHILD PAGE title and content
- Display subpages under parent page as a list within a loop
- Is including the loop necessary for page.php? [duplicate]
- Two custom loops, pagination, offset
- Identify the page being shown while in The Loop
- Related Posts loop – offset
- Post Loop not Returning Permalink
- Loop through two different sets of custom fields
- pop-up lighbox with AJAX
- If Loop has odd number of posts on last page Custom style for last post in it
- Get posts that matches specific terms of multiple custom taxonomies
- Ajax loop in sidebar to load post titles/categories
- Filtering posts by multiple taxonomies
- Ajax loop refresh on click
- Add Infinite Scroll to Ajax Loaded Category Query
- Load comments per post on click with AJAX
- Chopping up a large ajax request of around 200 posts [closed]
- single page site with subpages
- Is get_posts() more efficient than The Loop?
- How to loop through ALL pages?
- Loop and Page template : my WP_query don’t take args
- Category Ajax call
- Create a loop that gets pages with their template
- Display content of page template (get_page)
- Loop after page content
- How to get_posts where ‘menu_order’ is more than 0/zero?
- Display the_content on click jquery
- What is the maximum number of posts a WordPress loop can work with?
- Sort posts by most recently modified
- Missing image in gallery shortcode in custom feed
- A smarter way to display multiple loops inside a page template
- How do I use AJAX Query in my posts loop?
- Get all posts including sticky ones with get_posts(),setup_postdata(), and foreach loop?
- Ajax Button to load more Posts into a timeline
- Get Page content to displayin Bootstrap Modal
- Shortcode in posts called by ajax is not working
- Show all posts using the template page and the loop?
- Showing sticky posts with get_posts()
- query_posts() vs get_posts() multiple loops [duplicate]
- How do I paginate a get_posts() request inside another page loop (Paginating childpages)
- How do I make a variable available inside partials?
- Both a page loop and posts loop on the same page
- How to get The Loop working with $wpdb->get_results()
- Multiple get_posts() queries on one page
- Exclude page name from loop
- Stepping through a foreach loop – adding +1 to the end of it so next time it loops it starts on item 2
- Include multiple page ids in loop
- 404 Template customization | Want 10 recent Post on the 404.php error page apart from the error Notice
- Output meta into arrays
- Scrolling Posts with Ajax
- Loop Offset for tag based “Related Posts”
- First archive page with a few posts
- Tags on page (not post) returns nothing – why? Improved clarified question!
- AJAX Breaking Offset Argument In WP Query
- Exclude page from loop results
- get_posts() forcing ignore sticky posts on main loop
- Fetching posts from wordpress function in ajax
- How to render the single post template with the post name?
- Print the whole page?
- WP_Query is only looping home page, not pages
- How do i create a list-posts-page?
- Offset Loop by 1 , Limit next loop to 1 (Most Recent) Post
- Using jQuery .after inside loop
- Getting selection of posts based on loop variables via Ajax
- loop inside a loop : search for posts in the same category
- Offset for Loop
- WordPress: query pages except remove one page
- Loop order issue with Ajax filter
- $post is undefined in wordpress loop [ajax]
- Database query and get_user_meta return incorrect data
- php loop error for count posts in category
- Submit form for loop of products of the term with AJAX
- Get gallery in loop through ajax
- Archive: Lists itself
- is it bad to copy the loop for a template?
- Get top Page IDs from menu and cycle through their child pages on a scroller
- How to avoid appending “null” in Ajax?
- Search – Check if post is a page on search page
- numberposts not responding to wp_reset_postdata()
- Structure and Display Content from Multiple Pages on Single Page
- Making a specific page wordpress compatable that is not index
- Ajax category pagination problem
- Default Template infinite loop of Title
- setup_postdata in “loop-handling” php file called via $.ajax
- Have multiple loops on a page appear after/between page content
- get_template_part() to render single page Theme
- get_posts and wp_autop (remove filter)
- Need some help with “the_widget()” function
- Is there a way to target only images within the loop?
- Show last post from multiple categories using wp_list_categories
- Load featured article once in a loop
- get_page() unlike Loop returns the post content without html tags. How can I fix this?
- Question about custom plugin
- AJAX in wordpress theme loop