WordPress.org

Ready to get started?Download WordPress

Forums

Tag Gallery
Sorting of images (3 posts)

  1. Destillator
    Member
    Posted 3 years ago #

    How can I sort the display of thumbnails? Any help would be greatly appreciated!

    http://wordpress.org/extend/plugins/tag-gallery/

  2. ratputin
    Member
    Posted 2 years ago #

    Is this possible? I am looking to do the same...

  3. mrwweb
    Member
    Posted 2 years ago #

    Warning: These instructions are for modifying the plugin. Do so at your own risk and only if you know what you're doing. Be aware that upgrading the plugin in the future will overwrite any changes you make now to the plugin.

    This may not work for either of you, but all I needed to do was reverse the order. The default order is oldest -> newest. Since I have already had to hack this plugin to remove TimThumb, I figured I might as well hack it some more. Hopefully this or a more-robust solution can be added to the next version. (Eh, @johnnypeck??)

    To add an "order" attribute to the shortcode that can reverse the gallery order, you'll need to edit /wp-content/plugins/tag-gallery/tag-gallery.php in the following ways:

    Around line 60, add this the end of the $defaults array:
    'order' => 'default'

    Around line 95, before "// Start the output of the tag gallery" add:

    if ( $order == "reverse" ) {
    	$images = array_reverse( $images );
    }

    Now, to reverse the gallery order, just add 'order="reverse"' to your shortcode like so:
    [tag-gallery tag="my-tag" order="reverse"].

    Remember that because "reverse" is the only meaningful value for the new "order" attribute, the following shortcodes all result in the default ordering:

    • [tag-gallery]
    • [tag-gallery order="default"]
    • [tag-gallery order="unicorns"] (or any other random word)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic