This support ticket is created hace 5 años, 5 meses. 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.
The table is initally sorted by post title in ascending order (set from Order by in top of the view settings page).
So i used Loop Wizard to create a table and added sort to it.
Now when you load the page and click the post title because you want to sort it, it will start to sort ascending.. the view is already ascending, i need to sort it descending on first click.
I tried adding order="DESC" as an argument to the table header in the view
Thank you for contacting us and I'll be happy to assist.
I'm afraid, there is no direct shortcode or filter available to change the default sorting order (front-end) to "DESC", but this can be achieved using a custom script.
1. First, please update your post title shortcode, to include a special class "fieldforsort":
2. Next, you can add the following script in "JS editor" tab under the "Loop Editor":
// function to get parameter from URL
function GetURLParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}
// function to update the default "data-order"
$(document).ready(function () {
var sort_order = GetURLParameter('wpv_sort_order');
if(typeof sort_order === 'undefined') {
$('a.fieldforsort').attr('data-order', 'desc');
}
});
I hope this helps! Please let us know how it goes and if you need any further assistance.
regards,
Waqar
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.