• Resolved mjg2

    (@mjg2)


    Before the 4.x version of the code I had made a minor update to allow my queries to use an offset in the sql.

    After 4.x it appears that this may be available. The file class-wordpress-popular-posts-query.php has the logic looking for (e.g. $this->options[‘offset’]) — however I don’t see the way to hook into this feature.

    Here’s our shortcode logic where I’d like to use offset:
    do_shortcode(‘[wpp thumbnail_width=150 offset=”3″ thumbnail_height=85 wpp_start=”‘.$wpp_start.'” wpp_end=”‘.$wpp_end.'” post_html=”‘.$wpp_html_pattern .'” limit=”4″ offset=”3″ order_by=”views” range=”all” stats_views=”‘. $views .'” stats_comments=”0″ cat=”‘ .$current .'”]’);

    Is this supported in another manner? Do I have to use query manually:
    eg.: $popular_posts = new WPP_Query( array(‘range’ => ‘last7days’, ‘order_by’ => ‘views’, ‘limit’ => 5, ‘offset’ => 3) );

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hey there!

    Here’s our shortcode logic where I’d like to use offset:
    do_shortcode(‘[wpp thumbnail_width=150 offset=”3″ thumbnail_height=85 wpp_start=”‘.$wpp_start.’” wpp_end=”‘.$wpp_end.’” post_html=”‘.$wpp_html_pattern .’” limit=”4″ offset=”3″ order_by=”views” range=”all” stats_views=”‘. $views .’” stats_comments=”0″ cat=”‘ .$current .’”]’);

    It’s been a while since last time I checked but I believe this code should work as is. If it’s not and the offset parameter is being ignored, let me know and I’ll have another look.

    P.S. You have offset set twice in there.

    Hi Hector, sorry to hijack this but I just tried the offset parameter and its not available/working in both shortcode or using template tags. I also cant find any offset parameters in the docs.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Thanks for confirming, @damienov. Ok, I’ll have a look into this as soon as possible.

    Thread Starter mjg2

    (@mjg2)

    Hi Hector,

    I re-tested my code without the duplicate (thanks) – and still did not get the offset value working. It does appear that the value is wiped out by the time you check $this->options[‘offset’] – in the function build_query…

    Thanks for looking into it,

    – Joe

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hey guys!

    WPP 4.0.10 exposes the offset parameter to the [wpp] shortcode and the wpp_get_mostpopular() template tag. It should work now ??

    Thread Starter mjg2

    (@mjg2)

    Great – thanks, Hector!

    Ooo shiny, thank you Hector

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘“OFFSET” value in options’ is closed to new replies.