Title: adding an &quot;offset&quot; parameter
Last modified: August 30, 2016

---

# adding an "offset" parameter

 *  [Ted Slater](https://wordpress.org/support/users/tedslater/)
 * (@tedslater)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/)
 * Would it be possible to add an “offset” parameter?
 * I’d like to split the output of the WPP plugin, with the 10 most popular posts,
   and then some content, and then the *next* 10 most popular posts.
 * This’d be a really helpful feature for an already amazing plugin.
 * [https://wordpress.org/plugins/wordpress-popular-posts/](https://wordpress.org/plugins/wordpress-popular-posts/)

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/adding-an-offset-parameter/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/adding-an-offset-parameter/page/2/?output_format=md)

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251163)
 * Hi Ted, thanks for the nice words!
 * Actually, that request has been sitting on Github (see [issue 47](https://github.com/cabrerahector/wordpress-popular-posts/issues/47))
   for quite sometime now 🙂 That feature (and a couple more) will come with version
   3.3.x.
 *  Thread Starter [Ted Slater](https://wordpress.org/support/users/tedslater/)
 * (@tedslater)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251164)
 * Thanks, Héctor!
 *  Thread Starter [Ted Slater](https://wordpress.org/support/users/tedslater/)
 * (@tedslater)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251312)
 * Great plugin! You haven’t added an “offset” parameter yet, have you? 😀
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251313)
 * Nope, _but_ I’m running a test version of WPP on my site with a new feature that
   kinda forces me to add the offset parameter (or else it’d be not much fun) 😉
 *  Thread Starter [Ted Slater](https://wordpress.org/support/users/tedslater/)
 * (@tedslater)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251314)
 * Thanks, Hector, for the update. I’m eager to see what you come up with!
 *  [lebucheron](https://wordpress.org/support/users/lebucheron/)
 * (@lebucheron)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251323)
 * Hi
 * I’m really interested in that feature, is it ready ?
 * Alternatively, is it possible to fetch like the 6 most popular posts and skip
   the first 3 ? That would work for me.
 * Thank you
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251324)
 * Hi there!
 * Unfortunately no, not yet. This past month I’ve been too busy with other projects
   and haven’t had the time to work on the new features.
 * If you really, _really_ can’t wait, you can always modify WPP’s code and modify
   the LIMIT clause to add the offset [here](https://github.com/cabrerahector/wordpress-popular-posts/blob/master/wordpress-popular-posts.php#L1474).
   Of course, next time you update the plugin this modification will be lost so 
   you probably should bookmark this topic for future reference in the case that
   the next release doesn’t include the offset feature.
 *  [lebucheron](https://wordpress.org/support/users/lebucheron/)
 * (@lebucheron)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251325)
 * Hi Hector
 * This hack will perfectly work for me.
 * Is limit just like OFFSET in the regular wp loop ?
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251326)
 * Yep. When passing the _offset_ parameter, WordPress actually translates that 
   into an extra parameter in the [LIMIT clause](http://www.w3schools.com/php/php_mysql_select_limit.asp)
   when building the query.
 *  [lebucheron](https://wordpress.org/support/users/lebucheron/)
 * (@lebucheron)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251327)
 * So if I want the 4th,5th and 6th most popular posts, it’ll go like this on the
   page ?
    wpp_get_mostpopular(“range=monthly&limit=3&offset=3&order_by=’views’&
   post_type=post”)
 * For the WPP code, I don’t understand what should be added, I’m sorry. Is it like:
   $offset = “OFFSET {$instance[‘offset’]}”; ?
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251328)
 * Nope, that won’t work.
 * Since _offset_ isn’t registered as a valid paramater, WPP will just ignore it(
   you know, I don’t want people passing random stuff to the plugin, security first
   and stuff :P).
 * You can keep the _offset_ parameter in _wpp\_get\_mostpopular()_ even knowing
   that WPP will ignore it since it’ll be available in the future, but change this:
 * `$limit = "LIMIT {$instance['limit']}";`
 * … into:
 * `$limit = "LIMIT {$instance['limit']} OFFSET 3";`
 *  [lebucheron](https://wordpress.org/support/users/lebucheron/)
 * (@lebucheron)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251329)
 * Ok it’s very clear now, but what if I want to set a different offset depending
   on the spot, or no offset at all ?
 * PS : it’s great to see someone thinking about security. Is there a pro version
   of this plugin ? I would gladly buy it
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251330)
 * Well, since it’s a hack you won’t be able to change the offset dynamically unless
   you also add the _offset_ parameter [here](https://github.com/cabrerahector/wordpress-popular-posts/blob/master/wordpress-popular-posts.php#L2813-L2843).
   Otherwise, you’ll have to wait till I implement the feature myself 😛
 * And no, there’s no pro version of WPP. All modesty aside, I believe that WPP 
   _is_ already pro as it is now – and for free! 🙂 I do have plans to add one or
   two new features that could be available only with a pro license (one of them
   will require hiring a dedicated server and thus I’d need money to pay for it)
   but that’s still far from happening.
 *  [lebucheron](https://wordpress.org/support/users/lebucheron/)
 * (@lebucheron)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251331)
 * Ok, I’ll try to make it work.
 * Thank you for your time
 *  Thread Starter [Ted Slater](https://wordpress.org/support/users/tedslater/)
 * (@tedslater)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/#post-6251332)
 * lebucheron wrote, “Is there a pro version of this plugin? I would gladly buy 
   it.”
 * I would too. 😀
 * Your plugin is top-notch, Hector. New features, and minimal hits to admin-ajax,
   are more than we can ask. 🙂

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/adding-an-offset-parameter/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/adding-an-offset-parameter/page/2/?output_format=md)

The topic ‘adding an "offset" parameter’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

## Tags

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

 * 16 replies
 * 3 participants
 * Last reply from: [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/adding-an-offset-parameter/page/2/#post-6251333)
 * Status: not resolved