Skip Navigation

[Resolved] Default table sort

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 1 reply, has 2 voices.

Last updated by Waqar 2 years, 11 months ago.

Assigned support staff: Waqar.


So i got this table that is listing members.

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

[wpv-heading name="post-title" order="DESC"]post title[/wpv-heading]

but it ignores this.

I see that the data-order in the output is set to asc. How do i change this to desc?

Debug info is not relevant in this case. Nor is access to the site required.
It's a simple question about usage, and not a site-specific question.

Thank you in advance



Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Thomas,

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":

[wpv-heading name="post-title" class="fieldforsort"]Post title[/wpv-heading]

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 =;
    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.