Image Ordering When Retrieving From A Post

Hi, firstly thanks for a great plugin, it's working really well on the whole.

I have a quick question related to ordering of images. I'm pulling in images that have been assigned to a page, using the shortcode [slideshow post_id="x"]

I'm having a problem though in that the images aren't displaying in the slideshow in the same order that they have been added to the gallery within the page. Any ideas? Happy to PM you a live link...

Thanks in advance,
Chris

Comments

  • 6 Comments sorted by
  • Vote Up0Vote Down
    Hi,

    After further investigation, I could see that the plugin couldn't preserve the order of the images it retrieves from a post, so I decided to edit the plugin itself.

    I've modified my version to allow for an extra shortcode parameter as follows: [slideshow post_id="x" imgids="1,3,2"].

    You may wonder why I needed this - I have pages that contain in-built WP galleries.  I need to be able to show the images from the page in a slideshow above it. Creating separate slideshows with your plugin wasn't an option, I needed to re-use the existing WP galleries.

    My page content is as follows (for page id 4321 in this example):

    [slideshow post_id="4321" imgids="1,3,2"]
    [gallery columns="4" link="file" ids="1,3,2"]

    Hope that makes sense, or helps someone else who needs the same thing.  My changes are all in slideshow-gallery.php see: http://pastebin.com/FdWBipVF

    Thanks again for the plugin, apologies if I have inadvertently butchered it with my changes! :)
  • Vote Up0Vote Down
    Hi Chris,

    Thanks for your post.

    Well done on making that work for you, although the normal way of ordering images in the slideshow when you call them from a post is to actually order the images via the media manager. Or is that the order it didn't preserve?

    Remember to keep a backup of your modifications for future updates, and don't simply replace new files with old backups - rather re-implement your mods on in the new file(s).

    Best regards,

    Phil
  • Vote Up0Vote Down
    Hi Phil,

    Yes the ordering was done via the media manager, but retrieving them from the post using the plugin didn't preserve that order. It uses get_children() and the order comes back randomly, or by menu order ascending.   I used the include parameter to pass in the img ids, and used orderby=post__in.

    Looking again at my shortcode above, I don't actually need the post_id parameter in the slideshow shortcode. Anyhow, it's working for me, and I'll keep a back up of my mods.

    Thanks,
    Chris
  • Vote Up0Vote Down
    Hi Chris,

    Thanks for your reply.

    It's really odd... that ordering is supposed to work. But if your modification works for you, then we're happy :)

    If you are happy and satisfied with our WordPress Slideshow Gallery plugin, please vote that it "Works" and give it a good rating on WordPress.org http://wordpress.org/extend/plugins/slideshow-gallery/

    Best regards,

    Phil
  • Vote Up0Vote Down
    Hi Phil, rating done, with some feedback about performance too - I noticed that each animated slide creates a new image in the DOM, which can cause your browser to become slugish if you leave the page open, and I'm using a powerful machine too.

    This isn't a complaint though; it'd be churlish to complain considering you're putting it out there as free software, but it might be an area for improvement when you guys get the chance.

    Cheers
  • Vote Up0Vote Down
    Thanks a bunch for that Chris, much appreciated.

    Thanks also for the heads up on that issue, I'll give your comments to our developer guys.

    Best regards,

    Phil
Sign In or Register to comment.