Skip Navigation

[Résolu] Show last page of view first

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.

This topic contains 5 réponses, has 3 voix.

Last updated by davidS-53 Il y a 1 an et 10 mois.

Assigned support staff: Minesh.

Auteur
Publications
#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: Anglais (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

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

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

#1337263

Minesh
Supporter

Languages: Anglais (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!