Forums

[resolved] [Plugin: NextGEN Gallery] Album sort order (13 posts)

  1. wpma
    Member
    Posted 2 years ago #

    How do i reverse the album sort order in Nextgen Gallery version 1.3.3?

    It´s changed since this topic were made, http://wordpress.org/support/topic/242457

  2. Alex Rabe
    Member
    Posted 2 years ago #

    In which list would you reverse the order ?

  3. wpma
    Member
    Posted 2 years ago #

    Hi! I would like to change the order in the album page. Newest first.

  4. wpma
    Member
    Posted 2 years ago #

    Any news on this Alex?

  5. pamlicoink
    Member
    Posted 2 years ago #

    NOt a coder and need help with NextGen Gallery question. Can the gallery be used twice on one page and if so how does one do that?

  6. wpma
    Member
    Posted 2 years ago #

    If anyone got a solution on this problem (see first post), please post =)

  7. CrisBloomfield
    Member
    Posted 2 years ago #

    If you mean that you want to change the sort order in the Admin section for the plugin, so that it lists newest albums first then I want to do the same thing!

    Had a very quick look at this and an attempt tonight to resolve it. In the plug-in files, there is a file called manage-galleries.php (within admin)

    I think that the listing of the albums is controlled by this line of code:

    $gallerylist = $nggdb->find_all_galleries('gid', 'asc', TRUE, 25, $start);

    Certainly if you change 25 to 50 it doubles the number of albums listed on the page. However, changing the display order from ascending (asc) to descending (desc) doesn't make any difference. Maybe this is a good starting point for someone else to take it forward?

  8. bonitapang
    Member
    Posted 2 years ago #

    I did it! Thanks for the starting point given.

    First I went to manage-galleries.php, which is in admin folder, and changed this line 24
    $gallerylist = $nggdb->find_all_galleries('gid', 'desc', TRUE, 10, $start);

    for the number 10, you can change it to anything you like, just the no of galleries to list on each page.

    Then I went to ngg-db.php is in folder lib. I use the find function to search for all words "asc", which is ascending, and whatever I saw that was related to gallery, I changed them into DESC. I think I changed it in about 4-5 different sections.

    e.g
    function find_all_galleries($order_by = 'gid', $order_dir = 'DESC', $counter = false, $limit = 0, $start = 0) {
    global $wpdb;

    $order_dir = ( $order_dir == 'DESC') ? 'DESC' : 'DESC';
    $start);

    basically anything that was realted to gallery and was showing ASC, I changed it to DESC, and now it worked, sorting in reverse order! So Happy!

    just to let know you, this is my first time touching any of these codes!

  9. Lenny
    Member
    Posted 2 years ago #

    I've tried making those changes bonitapang but didnt have any success..

    How can it be that natively there isnt any option to sort albums?

    I'm using the tag [ album id=x template=extend ]

    Any ideas?

  10. Lenny
    Member
    Posted 2 years ago #

    NVM - Just found the answer here:
    http://wordpress.org/support/topic/242457?replies=9

    File: nextgen-gallery\lib\ngg-db.php
    Line: 293
    Replace With: $album->sortorder = serialize( $wpdb->get_col("SELECT gid FROM $wpdb->nggallery ORDER BY gid DESC") );

    Done :)

  11. wpma
    Member
    Posted 2 years ago #

    Thank you for all your answers!
    Resolved!

  12. Lenny
    Member
    Posted 2 years ago #

    In the latest version 1.4.0 this is now line 317

    Change from

    $album->sortorder = serialize( $wpdb->get_col("SELECT gid FROM $wpdb->nggallery") );

    To

    $album->sortorder = serialize( $wpdb->get_col("SELECT gid FROM $wpdb->nggallery ORDER BY gid DESC") );

  13. Kadr
    Member
    Posted 1 year ago #

    is there no way to change the order of pictures without having to modify files?

Topic Closed

This topic has been closed to new replies.

About this Topic