Skip Navigation

[Gelöst] Show last page of view first

This support ticket is created vor 4 Jahre, 7 Monate. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 Antworten, has 3 Stimmen.

Last updated by davidS-53 vor 4 Jahre, 7 Monate.

Assisted by: Minesh.

Author
Artikel
#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: Englisch (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: Englisch (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!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.