Support » Plugin: Pretty file list » [Plugin: Pretty file list] Sorting File List

  • Resolved Frederik

    (@cpt_copcyat)


    Hey,

    I have to say that is a great plugin (very simple and to the point). I really appreciate this plugin for its ease of use and great looks.

    I still was wondering if there is an option to have the files sorted (for example alphabetically or a custom order). I tried setting the order in the media gallery library, but this doesn’t work. Also checked out the code, but I’m not really good at php 😉

    Is there a way to make the file list sorted alphabetically.

    Either way, big two thubms up for this super plugin, love it 🙂

    Best Regards,
    Frederik

    http://wordpress.org/extend/plugins/pretty-file-lister/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author smartredfox

    (@smartredfox)

    Hello Frederik,

    Thanks for using the plugin, and I’m glad you like it.

    Currently there is no sorting option in the free version of the plugin (I’m working on a more fully featured pro version), but I will try to filter this down into the free version as soon as the Pro version is complete.

    Thanks again,
    James

    You can do this by editing the PrettyFileList.php file in the plugin directory. However, note that these changes will be overwritten by a plugin update. (But since the author gives the sign he is going to include this option, that might not be a problem.)

    Open the PrettyFileList.php file and go to line 80. There you will find the following code:
    $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => get_the_id(), 'post_mime_type' => $mimeTypesToGet);

    Just add the following into the array:
    'order'=> 'ASC', 'orderby' => 'title'

    so it will look like this:
    $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => get_the_id(), 'order'=> 'ASC', 'orderby' => 'title', 'post_mime_type' => $mimeTypesToGet);

    No the list will be sorted alphabetically.

    What about making this list sort in Reverse?

    Is that possible too?

    thanks

    Yes, just change
    'order'=> 'ASC', 'orderby' => 'title'
    into
    'order'=> 'DESC', 'orderby' => 'title'

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Pretty file list] Sorting File List’ is closed to new replies.