Skip Navigation

[Resolved] Show last page of view first

This support ticket is created 5 years, 2 months 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 3 voices.

Last updated by davidS-53 5 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#1334713

Say I have a view that has three pages.

Page 1: 10 items
Page 2: 10 items
Page 3: 4 items.

When the view is first loaded, I want to show the last page- ie. page 3, with it's 4 items. Reversing the sort order won't work because I only want the 4 items on the first page.

I don't seem to be able to find anything in the documentation to work out how to do this?

I have a couple of possible solutions, but wanted to check that i'm not missing anything obvious first. I was thinking of using JQuery to trigger a click on a pagination "Last Page" link, or pulling the last page number using [wpv-pager-total-pages] and using that to update the url parameter &wpv_paged=

Is there a better way to achieve the same result? Cheers!

#1334757

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I see both possibility, so I suggest you should try to grab the last page link and redirect the user on last page that would be the easy way to fix this.

#1335887

Here's the JS i'm using if anyone needs it:

if ( $("body").hasClass("page-id-12345") ) {

		var oldurl = window.location.href;
		var arr = oldurl.split('?');
		var newurl = '<em><u>hidden link</u></em>'.wpv-filter-last-link').attr("href");

		if ( arr.length > 1 && arr[1] !== '' ) {
			// Do nothing- parameters exist.
		} else {
			window.location.replace( newurl );
		}

	};
#1336335

Thanks for sharing the JS workaround, that will help other users.

#1337263

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thanks for sharing the solution. Please feel free to mark resolve this ticket 🙂

#1337293

My issue is resolved now. Thank you!