WordPress.org

Ready to get started?Download WordPress

Forums

Image Gallery Reloaded
Making the gallery respect image order (18 posts)

  1. jonfold
    Member
    Posted 1 year ago #

    Hi All.

    I was struggling a bit with getting this plugin to display images in my gallery in the custom order that I had configured in my post and not just by "ID ASC".

    I made a change to the file: "image-gallery-reloaded/image-gallery-reloaded.php" (press edit from the plugins page to open up the file editor).

    Here's a step by step guide:

    1. Scroll down to the function: "function igr_gallery_shortcode($attr)"
    2. Just after you see "$count = 1;", replace the following code:

    ------------------------
    if(!empty($ids))
    {
    $ids = preg_replace( '/[^0-9,]+/', '', $ids );

    $_attachments = get_posts ( array(
    'include' => $ids,
    'post_type' => 'attachment',
    'post_mime_type' => 'image',
    'orderby' => $orderby
    )
    );
    $attachments = array();
    foreach ( $_attachments as $key => $val )
    {
    $attachments[$val->ID] = $_attachments[$key];
    }

    }
    ------------------------
    with this one:
    ------------------------

    if(!empty($ids))
    {
    $ids = preg_replace( '/[^0-9,]+/', '', $ids );

    $ids_array = explode(',', $ids);

    $_attachments = array();
    foreach ( $ids_array as $get_this_id ) {
    $_attachments[] = get_post($get_this_id);
    }

    $attachments = array();
    foreach ( $_attachments as $key => $val )
    {
    $attachments[$val->ID] = $_attachments[$key];
    }

    }
    ------------------------
    Now it should work.

    Perhaps this could be invorporated into the next version of the plugin?
    (I'll try to make a branch on github).

    http://wordpress.org/extend/plugins/image-gallery-reloaded/

  2. criticalbandwidth
    Member
    Posted 1 year ago #

    This fix worked for me. The images are now showing up in the order they are placed in the Gallery. Thanks a lot! You should definitely try to submit the fix on github as this is definitely an annoying bug on an otherwise excellent gallery plugin!

  3. ilvez
    Member
    Posted 1 year ago #

    Thats superb! Many thanks, now the gallery order works.

    Do you might have a suggestion how to turn off the image cropping/stretching in main window, it is basically preventing me to use otherwise fantastic plugin.

    The problem description with examples are here:

    http://wordpress.org/support/topic/how-to-turn-off-croppingstreching-of-images-image-order-wrong?replies=1

  4. bettina_peru
    Member
    Posted 1 year ago #

    People: You`re just genius!!!!!!!!!! THANKS!

  5. Cie Martire
    Member
    Posted 1 year ago #

    So grateful for your help!!! You saved my day!!!
    GENIUS!!!!

  6. AFPhoto
    Member
    Posted 1 year ago #

    This saved my day....great job!
    THANKS!!!

  7. Whistos
    Member
    Posted 1 year ago #

    Thank You ;-)

  8. BrittanyLea
    Member
    Posted 12 months ago #

    This absolutely did the trick!! Thank you, thank you, thank you!

  9. youtag
    Member
    Posted 9 months ago #

    thanks for the quick fix, jonfold.

    any luck with the github branch? I wish wordPress would provide any way for the community to branch "abandoned" plugins?

  10. jonfold
    Member
    Posted 9 months ago #

    No problem guys - I'm glad you could use it. It's not a pretty fix, but it works. :)
    No luck with the github branch, though.

  11. piersb
    Member
    Posted 7 months ago #

    Thanks! Sorted my problems too...

  12. piersb
    Member
    Posted 7 months ago #

    …and now integrated with the github master branch at https://github.com/DanielSachs/image-gallery-reloaded :)

  13. Daniel Sachs
    Member
    Plugin Author

    Posted 7 months ago #

    @youtag absolutely! Don't understand why in order to cooperate we are forced to use external services...

    Thank you @piersb for your contribution!

  14. piersb
    Member
    Posted 7 months ago #

    @jonfold did all the running on this one...

  15. piersb
    Member
    Posted 7 months ago #

    @jonfold did all the running on this one...

  16. 2xUeL
    Member
    Posted 7 months ago #

    Amazing fix, thanks! I wonder why this still hasn't been implemented into the plugin's actual code nine months later??

  17. ashleighm
    Member
    Posted 6 months ago #

    Worked for me, too. Thanks!

  18. leoluz
    Member
    Posted 6 months ago #

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic