WordPress.org

Forums

[resolved] Default Media Slideshow (11 posts)

  1. rekkette
    Member
    Posted 1 year ago #

    Does anyone know about the default media slideshow accessible from the wordpress insert image dialog box?

    Does WP offer any modifications? If so, how do I access it/modify it without screwing up any updates?

    I'm already working on a child theme, so I could easily write a new file, but how do I make sure it will override the defaults?

  2. rekkette
    Member
    Posted 1 year ago #

    Hi, I need to edit this post. I found another term that will be necessary to answer my question, but if I post a new topic with the essential term, the moderators will simply delete it.

    Is there anyway to edit this post so that I might have a chance to get my question answered?

  3. bcworkz
    Member
    Posted 1 year ago #

    No, you only get a brief time period after posting when editing is still available. While bumping posts is actively moderated, people can usually get away with a second sequential post as long as they are presenting new information, as what has apparently happened here.

    Why don't you just tell us what this essential term is? I would hope we are clever enough to figure out your intention without you needing to re-compose your initial post. I'm sure we can piece the bits together, once we have all the bits :)

  4. rekkette
    Member
    Posted 1 year ago #

    Thank you SOOO much. Well, I realized that the default slideshow (it utilizes the native media library) is actually a function of Jetpack.

    So... essentially, I'd like to modify the Jetpack slideshow that utlized the native wp media library.

    While I realize I can easily override the CSS without screwing up updates, modifying the javascript... I don't think I can do that... or if I can, where would I put the overiding javascript files without damaging the core structure?

  5. bcworkz
    Member
    Posted 1 year ago #

    Your child theme folder will work. The key is when you enqueue your javascript files, be sure your callback function that does the actual enqueuing is called after the files you are trying to override are enqueued. This is done by providing a higher priority number when you add your action callback.

    You can confirm this worked by observing your meta link in the resulting page HTML is after the other meta links.

  6. rekkette
    Member
    Posted 1 year ago #

    You're right. That should work. I'll work on it. Thanks for helping me think it out...
    Gonna go try it now.

  7. rekkette
    Member
    Posted 1 year ago #

    Okay... I was about to try this out and then I realized that I need to override the .php as well.

    My first problem with that is that I can't locate the Jetpack file that contains the html output for the slideshow shortcode.

    My second problem is - again, I can't overwrite that output anyway.

    I was thinking I would just create a custom template that would activate the slideshow... in theory, that should still work, shouldn't it?

    I don't know... I'm getting so confused. I might just install a plugin and say to heck with it.

    I just don't like any of the plugins because you have to enter all the metadata twice - once for the actual WP Media Library, and the second time under the plugin settings.
    I was hoping to be able to streamline the process by using the native media library's meta data.

  8. bcworkz
    Member
    Posted 1 year ago #

    Unfortunately, I don't know anything about jetpack slideshows. If it's using a template, you could replace it with your own, but unless some sort of template hook is provided, it could be difficult to do cleanly in such a way that jetpack updates do not erase your efforts.

    I also know little about the media library, I'm not sure how you would get selection data out of it. You may find out why all the plugins make you enter the selections separately!

    One possibility, if you do not need the static gallery functionality, would be to take over the gallery shortcode and have it do a slideshow instead of a static gallery. The shortcode handler is easily overwritten, and cleanly so. One would add images exactly like a gallery, it's what happens when the shortcode is encountered that changes.

  9. rekkette
    Member
    Posted 1 year ago #

    Well, that's essentially what I was trying to figure out how to do.
    I mean override the gallery shortcode.

    Again, I'm new at this but I need three things to get it to look and act the way I want:
    1. CSS (I can easily add custom CSS in a child theme, no problem)
    2. Specialized javascript (thanks to your suggestion, I'd just call it in the head before the other link to the javascript)
    3. The php output that defines what the shortcode will produce

    It's the third that I don't know how to control. Where do I overwrite the shortcode handler?

  10. bcworkz
    Member
    Posted 1 year ago #

    Ooo! That answer I do know!
    https://core.trac.wordpress.org/browser/tags/3.8.1/src/wp-includes/media.php#L689

    Note the 3 lines starting line 716. If your filter callback returns HTML output, it will be echoed in place of the shortcode instead of whatever the rest of the function would have generated. It does mean your callback must generate all the HTML for the gallery, but that means you have complete control over the content.

  11. rekkette
    Member
    Posted 1 year ago #

    Yee-hee! Thanks professor! I'll see what I can do!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.