Support » Plugin: Gallery Slideshow » I've added the ability to link images

  • Resolved joshuamcgee

    (@joshuamcgee)


    Hi Jethin,

    Firstly, I love the plugin. You saved me a lot of time. Thanks!

    I needed to be able to click the images and have them take me a page, so I forked v1.3.1 and added the required code. It now takes an additional option, link, that works much the same as it does in the native gallery shortcode (the difference being, of course, that the native one defaults to linking to the attachment page and GSS defaults to none, so the options supported are none, file, and attachment_page, defaulting to none).

    A working installation can be found at http://collectpostmarks.com/gallery-slideshow/, with attachment_page set as the link option (it redirects you to a post because I’m using the Yoast SEO feature that redirects attachment pages, but the attachment page is the actual target).

    Would you like a patch file to consider adding this functionality to the next release?

    Thanks again!

    https://wordpress.org/plugins/gallery-slideshow/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author jethin

    (@jethin)

    Hi Josh. Very cool — nice work and neat site! I’d like to include linked images in the plugin, but I think it’d be worthwhile to try to integrate this functionality with WP’s gallery tool somehow. (This would keep things simple and help empower non-technical users.) But then what should be an easy task becomes a bit trickier. My first thought might be to try to integrate GSS with the WP Gallery Custom Links plugin.

    What do you think?

    joshuamcgee

    (@joshuamcgee)

    Thanks for the kind words!

    Yes, it would be awesome to link it into the WP gallery tool. You could, say, have an option like this in the tool:

    http://mcg.ee/gss-demo1.png

    Then, depending on whether the user chooses “GSS Gallery” or “WordPress Gallery”, you could have it output one of two flavors of shortcode, like this:

    http://mcg.ee/gss-demo2.png

    Then you add a post_gallery filter to your code. If ‘display’ is ‘slideshow’, replace the gallery with GSS code; if not, let WordPress handle it.

    That is really straightforward, and integrates perfectly. Unfortunately, the GSS plugin doesn’t add an option to the [gallery] shortcode. It adds its own shortcode. And changing the WP Gallery to output your shortcode either becomes super-hacky or super-fragile (as in, it wouldn’t withstand a WP version upgrade), because the code that inserts the string “[gallery” is hardcoded inside an anonymous function in gallery.js.

    So, yeah. You don’t want to entirely migrate over to the syntax I showed, because it would strand your existing users. You could leave that as “legacy syntax” and have the existing shortcode call the native gallery function, which then would either render a slideshow or fall through to the default behavior. That’s what I would do if it were my plugin.

    Would you like help? Those aren’t fake screenshots; it’s literally a few lines of extra code to add that select box to the gallery page, and then you’re golden. It’s your call what you want to do from here, but if you want to integrate with the built-in WP Gallery, you’re going to have to use “[gallery]“, not “[gss]”.

    Plugin Author jethin

    (@jethin)

    My initial thought was to target whatever variable the WP Gallery Custom Link plugin stores for each image and simply echo it for each image if it exists. But your suggestion of hooking into the default WP gallery shortcode is certainly cooler. I agree that legacy syntax would have to remain, but v. 1.4+ could go this route. The one downside would be that custom links would still be off the table. But could probably extend to also support the WP Gallery Custom Link plugin with a bit more code.

    I’m not too familiar with modifying native WP component (e.g. gallery) settings. If this is something you have the motivation and bandwidth to tackle you’re welcome to do it. I’d be happy to link you in to the GSS repository if so. Or let me know if you have other ideas.

    Another crazy thought: I haven’t looked at the default WP gallery HTML output in awhile, but it might be possible to just wrap a slideshow around the existing output. Would be a totally different plan of attack and would probably require some JS jujitsu, but could be be an interesting project.

    Hi guys,

    I’ve been looking around for a solution to be able to link images, and this seems to be an awesome solution! Could you please share this?

    Plugin Author jethin

    (@jethin)

    Desire to link images in future version noted. Marking topic as resolved.

    Hey guys,

    Sorry to leave you both hanging.

    s2ontwerp, if you have experience applying code patches at a command line, I can send you a patch file that allows linking until the plugin has that feature.

    jethin, sure, I’d love to contribute to the repo. I have another feature in mind that allows galleries to switch from WP galleries to GSS galleries with a URL parameter. That wouldn’t be difficult and sounds really useful. Integrating with P Gallery Custom Links wouldn’t be much harder.

    Another crazy thought: I haven’t looked at the default WP gallery HTML output in awhile, but it might be possible to just wrap a slideshow around the existing output.

    Nifty, but probably not a good idea. The default output is pretty bad HTML, and the plugin would be fragile — if the WP core team decided to improve it, it would break all of a user’s sliders if they upgraded WP versions without upgrading GSS.

    If you want to continue this offline (either of you), I can be reached at joshuamcgee.removethis@gmail.com — without the ‘.removethis’ part. 🙂 I should have some free time this weekend.

    Thanks.

    BTW, if you’re interested in a demo of different slider link types on the same site:

    As of this writing, if you go to http://collectpostmarks.com/gallery/, the first image on the slider at the top of the page is one of the LIGO Gravitational Wave covers that I designed. Click on that, and you’ll go to a detail page.

    On that detail page, there’s another slider with six slides (one for each of the six covers in the set). Click on any of those and it will open a 1280px-wide image.

    @joshuamcgee I’d be very interested in your interim linking solution. Would you be able to send me the patches? or perhaps a zip of the files you modified?

    Thanks!

    -Michael

    • This reply was modified 6 months, 3 weeks ago by  mpmchugh.

    @joshuamcgee i’d be very interested too in the patch you’re offering.
    any chance you could send a copy? or why not post the mods here for anyone to use?

    thanks!

    • This reply was modified 5 months, 2 weeks ago by  maxgx.

    @maxgx, I had to re-fork from the current version. Here is a gist that links to the images’ URLs by default (please see the first comment at the bottom for the changes I made). I haven’t re-wired the logic to accept arbitrary links yet, but maybe this will get you what you want.

    thanks joshua, will try it out asap!

    Plugin Author jethin

    (@jethin)

    @joshuamcgee @mpmchugh @maxgx : Hi all. I plan to release v 1.4 of the GSS plugin shortly. Version 1.4 includes image linking via gallery settings or custom URL (custom meta field on individual images), image size control (also via gallery settings) and other enhancements. This is a pretty big update so I’d appreciate any feedback you can provide in testing/debugging. Thanks!

    • This reply was modified 4 months, 3 weeks ago by  jethin.
    • This reply was modified 4 months, 3 weeks ago by  jethin.

    hey @jethin that’s good news indeed!
    is v1.4 available to donwload, so that i can test it?
    thanks!

    Plugin Author jethin

    (@jethin)

    @maxgx : I’ve uploaded the new version 1.4 to the WP plugin directory, so you can download here or update the plugin directly on your WP platform. Let us know how it goes. Thanks.

Viewing 14 replies - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.