The changing the sort options of WordPress plugin “NextGEN Gallery” doesn’t affect on the images of the gallery sorted by tags. To fix the bug, do the following changes in nextgen-gallery\lib\ngg-db.php

set

// Check for the exclude setting
 
$ngg_options = get_option('ngg_options');
$gal_sort = $ngg_options['galSort'];
$gal_sort_dir = $ngg_options['galSortDir'];
 
if ( $gal_sort_dir == 'RAND' ) {
   $order_clause = 'ORDER BY rand() ';
} elseif ( $gal_sort_dir == 'DESC' ) {
   $order_clause = ' ORDER BY t.'.$gal_sort.' DESC';
} else {
   $order_clause = ' ORDER BY t.'.$gal_sort.' ASC';
}

instead of

// Check for the exclude setting
 
$order_clause = ($order == 'RAND') ? 'ORDER BY rand() ' : ' ORDER BY t.pid ASC' ;

in the function find_images_in_list.

Getting the sort options from the database that is set in this function for not affecting on the work of other functions.

Share

11 Comments on WordPress Plugin NextGEN Gallery Sorting Bugfix

  1. TFM says:

    Fix works perfect – thank you so much!

  2. Julia says:

    This didn’t work for me. Any idea why?

  3. Julia,

    Please write the versions of WordPress and the plugin “NextGEN Gallery” that you use and I’ll try top help you.

    Thank you.

  4. Joanne says:

    Thanks for posting this fix. I wondered if anyone corrected the sorting bug in next-gen gallery for the galleries by tag. Totallly awesome of you to post it — thanks it worked great just as you posted it.

  5. 13 says:

    This worked for me for the latest version of WordPress and NextGEN Gallery as of November 2011. Thank you so much!

  6. Joanne and 13, it is really great to help you!!!! :)

    Thanks.

  7. Kees says:

    Thanks! Been struggling with this a while!
    Cant you persuade Alex to include this in the code ;)

  8. Hi Kees,

    Sorry, but it is not my problem!!! :)

    Thanks.

  9. chris vo says:

    YOU SOLVED MY PROBLEM! THANK YOU

  10. lisa says:

    Thank you for your post! I found it very useful and fast for my website!

  11. Peter Cunningham says:

    Thanks very much, that worked perfectly for me too.

Leave a Reply

*


*

Info