Title: offset in single.php
Last modified: September 1, 2016

---

# offset in single.php

 *  [rc_90_2000](https://wordpress.org/support/users/rc_90_2000/)
 * (@rc_90_2000)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/offset-in-singlephp/)
 * how to get a current post index number for “offset” function in single.php?
 * I would like to loop the previous post (starting from current post) and using“
   offset” function, I try to (while & count++) to find out the index number of 
   current post.
    (offset='”.$current_post_index_number.”‘) in single post.
 * But my website have over 10000+ posts.(while & count++) to find out the index
   number of current post will hangup the server.
 * is it possible having other method or function to do it ?
 * [https://wordpress.org/plugins/ajax-load-more/](https://wordpress.org/plugins/ajax-load-more/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [rc_90_2000](https://wordpress.org/support/users/rc_90_2000/)
 * (@rc_90_2000)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/offset-in-singlephp/#post-7516203)
 * code :
    [http://pastebin.com/LF97g6PW](http://pastebin.com/LF97g6PW)
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/offset-in-singlephp/#post-7516307)
 * Hi rc_90_2000,
    I’m not sure about the offset in single.php… We have the [Previous Post add-on](https://connekthq.com/plugins/ajax-load-more/add-ons/previous-post/)
   for use on single templates.
 * Cheers,
 *  Thread Starter [rc_90_2000](https://wordpress.org/support/users/rc_90_2000/)
 * (@rc_90_2000)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/offset-in-singlephp/#post-7516311)
 * I have bought it, but this add-on just shows only one post on a time, i need 
   10 previous post lists on a time.
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/offset-in-singlephp/#post-7516321)
 * That’s not possible with this add-on.
 * You really just need a post listing then?
 *  Thread Starter [rc_90_2000](https://wordpress.org/support/users/rc_90_2000/)
 * (@rc_90_2000)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/offset-in-singlephp/#post-7516323)
 * Yes, i need the post list offset from current post.(e.g. user read the 1000th
   post. the list shows post without next post(NO 999th post or other newer post),
   just only showing previous post.)
 * But i can’t use while loop & count++ method to find the index number of current
   post for offset. Because there are over 10000 posts on my website. If many user
   read the 1000th post. While loop & count++ method with hangup my web server.
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/offset-in-singlephp/#post-7516468)
 * This really sounds like you need a custom solution, not this add-on.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘offset in single.php’ is closed to new replies.

 * ![](https://ps.w.org/ajax-load-more/assets/icon-256x256.png?rev=2944639)
 * [Ajax Load More – Infinite Scroll, Load More, & Lazy Load](https://wordpress.org/plugins/ajax-load-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-load-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-load-more/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-load-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-load-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-load-more/reviews/)

## Tags

 * [offset](https://wordpress.org/support/topic-tag/offset/)

 * 6 replies
 * 2 participants
 * Last reply from: [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/offset-in-singlephp/#post-7516468)
 * Status: not resolved