WordPress Plugin NextGEN Gallery Sorting Bugfix

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/Bookmark
1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading ... Loading ...

3 Responses to “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. Daniel Hauca says:

    Julia,

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

    Thank you.

Leave a Reply

*





Info