WordPress.org

Ready to get started?Download WordPress

Forums

File Away
[resolved] Sort table or list backwards: Z to A (5 posts)

  1. MM
    Member
    Posted 8 months ago #

    Wow! Quite a plugin!

    I am using [fileaway type="table"] to list pdf's in a directory. The naming scheme for the files is by date: eg '11-15-2013 filename.pdf'

    In this way, the table is sorting by month number. However, the problem is, I'd like to list the most recent dates at the top of the list, rather than requiring the user to either sort it, scroll down, or -- in the case of pagination -- click to new pages.

    People are going to come to this page expecting to download the most recent file, and if they have to sort every-time, or click to the end, I'm afraid the grandmas might not find the file they're looking for.

    Not sure if there's a way to do this, or if it's a shortcode attribute you can include in a near-future release.

    Thanks so much for this amazing plugin. Glad I found you. Rating 5 stars.

    http://wordpress.org/plugins/file-away/

  2. thomstark
    Member
    Plugin Author

    Posted 8 months ago #

    Hey, thanks for the nice review and for reaching out with your request. Could you provide me a link to the page where the table is inserted? I want to be sure I understand what you need before I approach a solution for you.

    We'll try to work something out for you.

  3. MM
    Member
    Posted 8 months ago #

    Sure thing - just sent an email with link.

  4. thomstark
    Member
    Plugin Author

    Posted 8 months ago #

    Here's a temporary fix for you until I get an updated version out.

    If you're comfortable making a minor edit to the PHP, go to:

    wp-content/plugins/file-away/includes

    and open up file-away.php in a code editor (e.g., Dreamweaver, or just Notepad). Find the line that reads:

    <th class='ssfa-sortname' data-sort-initial='true' title='Click to Sort'>File Name</th>";

    You'll make one small change. Change:

    data-sort-initial='true'

    to

    data-sort-initial='descending'

    Save the file, then refresh your page.

    Note that this will change the behavior for all tables. I'll try to get a new version out soon with a new shortcode attribute that will allow you to choose which column to sort first, and whether to sort ascending or descending. In the meantime, this will solve your problem.

    If you need to change it for the attachaway shortcode as well, open up attach-away.php (it's in the same directory). Find that same line, and make the same change.

    All the best, and thanks again.

  5. thomstark
    Member
    Plugin Author

    Posted 7 months ago #

    Version 1.2 is now up and available. Added a new shortcode attribute that allows you to choose which column to sort initially, and whether to sort it ascending or descending. So the above temporary solution is now obsolete.

Reply

You must log in to post.

About this Plugin

About this Topic