[Solved] Slidehow function for post images ignores the parameters
Hi,
I'm using your plugin to show all post attachments in a gallery.
I've noticed that the parameters I can set are not used for this condition (code from the plugin file "slideshow-gallery.php"):
//... } else { global $post; $pid = (empty($post_id)) ? $post -> ID : $post_id; if (!empty($pid) && $post = get_post($pid)) { $children_attributes = array( 'numberposts' => $numberposts, 'post_parent' => $post -> ID, 'post_type' => "attachment", 'post_status' => "any", 'post_mime_type' => "image", 'orderby' => "menu_order", 'order' => "ASC", ); //...
I would like to use my own order and orderby parameters. Would be great if they get filled by the array $params which I can pass to the slideshow function:
slideshow($output = true, $gallery_id = false, $post_id = get_the_ID(), $params = array('orderby' => array('ID', 'DESC')));
Thanks, I hope that helps regards Olaf
Comments
@finalwebsites
Thank you for your post and sorry for the wait in getting back to you on this.
Yes, you're right, the post/page images are defaulting to
menu_order ASC
which is the order in which they are dragged/dropped in the media gallery itself. We're logging this as a bug so that we can fix it.In the meanwhile, can you please edit the
slideshow-gallery.php
fileorderby
andorder
like this: https://gist.github.com/tribulant/6bbeffe30deb3ec2e44aThat way it will use your custom order. We'll include this fix in the next update.
Are you using ID for the key by the way?
@finalwebsites
We've added the ability to specify the orderby parameter/argument for all possible slideshows.
To use this, we added orderf and orderd parameters for the function and shortcode:
orderf
- The field to order by such as ID, order, post_title, post_date, modified, etc. depending on the context.orderd
- The direction to order by. Use value ASC for ascending (low to high, small to large, old to new) and DESC for descending (high to low, large to small, new to old)We will release an update shortly with this and several other things included.