Support » Plugin: Tag Gallery » [Plugin: Tag Gallery] Sorting of images

Viewing 2 replies - 1 through 2 (of 2 total)
  • Is this possible? I am looking to do the same…

    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)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Tag Gallery] Sorting of images’ is closed to new replies.