Support » Plugin: MP3-jPlayer » [Plugin: MP3-jPlayer] Sort by file date

  • Hi there,

    I’m using the mp3j-ui widget.
    In the ‘More options’ side there is a ‘Playlist the tracks in alphabetical order’ checkbox. I have this unchecked, but the playlist appears in alphabetical order.

    There is an option to change the order of the playlist? For example to file date (it’s the uploaded order) with the last file on top.

    You can see this at the bottom of right sidebar


Viewing 8 replies - 1 through 8 (of 8 total)
  • Yes, I too need a way to sort a playlist by date (latest on top as well)
    We anxiously await your reply.

    Hey David, Simon answered me to my mail:

    Hi Pau,
    yes there is but it’s only in my development version at the moment! Let me know if you’d like to try it out (v1.8beta) and i’ll send it over (you can sort library files a few different ways with it)

    ps. the alpha order option is a bit weird in 1.7.3, as it’s also the default (and sometimes the only way files can be ordered) it was more of an over-ride function but it wasn’t obvious!

    You can write him to sinomward at yahoo dot co dot uk
    So maybe I can mark it as resolved..

    What I did (with 1.7.3) is write numbers on the file name (like “42 Cesk Freixas – Que no et falli mai la sort.mp3”), and then not showing this number with PHP. Quite anoying but not too much.


    In version 1.7.3 with the Playlist the tracks in alphabetical order option enabled, the default sorting looks like this (when using the [mp3-jplayer tracks="FEED:LIB"] shortcode):

    1. 07-15-2012
    2. 07-16-2012
    3. 07-17-2012

    Dandy. But I needed the reverse order (with the most recent date at the top).

    I emailed Simon regarding 1.8beta too, but in the meantime, I just edited mp3j_main.php to reverse the default sorting order (which suits my needs perfectly).

    I added the following line to mp3j_main.php at line 690 (just before the $theTrackLists array is built):
    $indexorder = array_reverse($indexorder);

    Now, I get this in the playlist:

    1. 07-17-2012
    2. 07-16-2012
    3. 07-15-2012



    I have tried to find where in my mp3j_main.php to put that line of code. I looked at line 690, but the $theTrackLists array isn’t right after that. I admit i am a novice at editing code, so if you could give me a little better clue, i would certainly appreciate it! using version 1.7.3

    Hmm… interesting, womynaloud. Here’s the edit I made in context. Perhaps that will help you to locate it.

    else {
    		foreach ( $theAssembledMeta['titles'] as $kt => $vt ) {
    			$indexorder[$x++] = $kt;
    $indexorder = array_reverse($indexorder);
    $theTrackLists = array(	'artists' => $theAssembledMeta['artists'],
    						'titles' => $theAssembledMeta['titles'],
    						'files' => $theAssembledMeta['files'],
    						'order' => $indexorder );
    return $theTrackLists;

    that is where i put the code the first time and it didn’t work. worked this time. it is perfect. thanks

    I forgot to mention that to make it work, it is also imperative that you hold your mouth precisely like this:

    that must have been my problem the first time!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: MP3-jPlayer] Sort by file date’ is closed to new replies.