Skip Navigation

[Resolved] can i continue the count of an ordered list with pagination?

This support ticket is created 6 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by Ido Angel 6 years ago.

Assisted by: Waqar.

Author
Posts
#1135669

hey,
i have an ordered list with pagination. i show 10 results each page. but right now the count of the list begins at "1" and ends at "10" on each page.
is there a way for the order to continue with pagination? e.g start the 2nd page with "11" instead of "1", and the 3rd page with "22" instead of "1" again...
thanks!

#1136032

Hi there,

Thank you for contacting us and I'll be happy to assist.

There is no direct shortcode available to get the loop items global position with the pagination, but there is a workaround:

1. Please wrap your [wpv-pager-current-page] shortcode in the "Search and Pagination" section, into a span tag with a special id "current-page-number":


<span id="current-page-number">[wpv-pager-current-page]</span>

2. In the "JS editor" tab below that "Search and Pagination" section, add following script:


$( document ).ready(function() {
    var pgNumber = $( "#current-page-number" ).text();
  	
    if (pgNumber > 1) {
      pgNumber = pgNumber - 1;
	  var pgNumberNew = pgNumber + "1";
      $("ol.wpv-loop.js-wpv-loop").attr("start",pgNumberNew);
    }
});

The above script will get the current page number and add a "start" attribute to the ordered list, to make it start from the relevant number, on each paginated result.

I hope this helps.

regards,
Waqar

#1136121

Hey!
Great - I should have thought of that brilliant solution myself 🙂
Cheers and thanks!
Ido