• Resolved John LeBlanc

    (@johnleblanc)


    Aloha Sébastien!

    I just worked out a fix for albums displayed out-of-order using the [sidi-discography] and [sidi-discography order_by=”release”] shortcodes.

    To order WP_Query results using a numerical meta_value, use ‘order_by’=>’meta_value_num’ as of WordPress Version 2.8:
    https://codex.www.ads-software.com/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

    Since SiDi saves album release date as UNIX time (seconds since epoch) within the ‘sidi-release’ post meta key, we need to use ‘order_by’=>’meta_value_num’ for the correct ordering.

    Using ”order_by’=>’meta_value’, sorting is alphabetical. Therefore, a meta_value of 63072000 (Jan 1, 1972) would be considered greater than 283996800 (Jan 1, 1979).

    The Fix

    Current SiDi_Shortcodes.php line 118:
    $query['orderby'][]='meta_value';

    New SiDi_Shortcodes.php line 118:
    $query['orderby'][]='meta_value_num';

    Mahalo!
    John

    https://www.ads-software.com/plugins/simple-discography/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author lermit4

    (@lermit4)

    Hi John,

    First of all, thank you for your contribution.
    j’ai effectué la correction que tu m’avais signalé. tu la trouveras dans la versions 1.2.4 .

    Regards,
    Sébastien

    Thread Starter John LeBlanc

    (@johnleblanc)

    Your turnaround time pushing the update is spectacular.
    Merci mille fois, Sébastien!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Ordering fix for shortcode [sidi-discography order_by="release"]’ is closed to new replies.