Reverse sort?
-
So I am starting to work on my academic personal website. I’m hoping to use Tablepress to help list all my articles. However, traditionally, academics need their work always listed in *reverse* chronological order. Is there a way to force this to sort in a reverse order (by year) at least originally without having to move items every time something is published?
The page I need help with: [log in to see the link]
-
Hi,
thanks for your post, and sorry for the trouble.
You have multiple options here:
- Either sort the table by column A on its “Edit” screen (double-click on the column header cell) (and repeat this whenever you don’t directly insert new rows at the top).
- Or, initiate an automatic sort when the page is loaded, by adding this to the “Custom Commands” text field in the “Table Features for Site Visitors” section on the table’s “Edit” screen:
"order": [ [ 0, "desc" ] ] - Or, take a look at the Row Order feature module that is part of the TablePress premium versions. This can essentially be used to automatically create that sorted view, but does so on the server.
Regards,
TobiasThank you, I had tried that first option but it never worked. Second one works like a charm though! Thank you!!
I’ll mark as resolved too. Thanks again.
Hi,
no problem, you are very welcome! 🙂 Good to hear that this helped!
Best wishes,
TobiasSooooo…. apparently this only started working with some of the tables. My most recent are not working. My clinical and teaching are still sorting incorrectly.
So in Opera it’s fine in everything. In Chrome, half are not working now but others are fine. I cleared my cache. I don’t understand.
Hi,
I can’t really check on your site right now, as it seems to have issues with your configured CDN and therefore looks off (with CSS files missing).
However, from what I can see, you are referring to column that have text like “2021-present” in them, right? These can indeed not directly be sorted, due to that text. The sorting algorithm can not know how to treat this. You could therefore look into using an approach like https://ww.wp.xz.cn/support/topic/date-order-6/ where you add a new column that only contains a single year, and which could then be configured to be used for sorting of the column that has years and texts mixed.
Regards,
TobiasSorry about that. Astra’s tech support had to log into my site yesterday to help with a mobile issue (menu no longer appears on mobile) and I don’t know what they did, but they screwed it up. I had to get a backup from a few days ago. It should be ok now.
But yes, you are correct. The hidden column trick seemed to work well enough at least in Opera… Thank you for that. I kept scrolling through all the posts a few times just to look for where to hide things and originally missed it in the plugin itself, haha. It’s too early in the morning to be working on websites. Sigh.A less annoying problem is there any easy way to not have certain columns information break in a certain way? IE, my clinical work. My work titles are long, I understand if that needs to break, but having my years break or the city/state break is strange.
Hi,
ah, I see. Sorry to hear that you are having trouble with your webhost.
The idea with the hidden column should work in all browsers, actually 🙂
To turn off line breaks in the “Year” and “Location” columns, you can add this to the “Custom CSS” text area on the “Plugin Options” screen of TablePress:
.tablepress-id-7 .column-1, .tablepress-id-7 .column-7 { white-space: nowrap; }Best wishes,
TobiasIt’s less the host, more the theme. As my husband (who works in IT mind you) he doesn’t understand why computers don’t behave consistently when I am in the room.
OK… so I just checked and it looks like it still isn’t fully working either on the clinical or the teaching page sorting wise. I have anything that is really listed as present listed as 50000 (or higher!) in the column which is higher (obviously than 2023). It was trying to trick me.
The clinical page isn’t breaking anymore though it still has the sort order.
The teaching page still isn’t sorting though it also has a hidden column which it is supposed to sort by AND it is still breaking column 1.
I checked it on Chrome, Opera, and iphone.
Hi,
from what I can see, there’s no new/hidden column that can be used for sorting the first column, at least on https://melsmarsh.com/healthcare/
That’s what you will have to add first, and then use that approach from my link.
To turn off the word-wrapping/line-breaks on the Teaching table as well, you’ll need to copy the CSS code from above and insert it again with the adjusted table ID for that table.
Regards,
TobiasSee that’s the thing… I am looking directly at it.
Here is a screenshot for the clinical page when in Tablepress. Likewise the courses and performance page are all set up similarly.

Hi,
ah, I see. Hiding the column on the “Edit” screen will not work. Instead, please unhide it there again, and then use the “Custom Command” that is explained in my link above. That will hide the column from the visitor (but it must be part of the frontend table, which is why hiding it on the “Edit” screen will not work), and also configure it for use when sorting for the (then)-second column of the table.
Regards,
TobiasWhat is the code? I tried
.tablepress-id-7 .column-0 { display: none; }and it’s not hiding column 0 and the table went back to breaking.
Also as you might notice, they are not reverse sorting and are not going away.
I think the tables are 5, 6, 7
The topic ‘Reverse sort?’ is closed to new replies.