WordPress.org

Forums

JSJ Gallery Slideshow
[resolved] Load js file only when used the gallery (5 posts)

  1. I see that the js file are loaded in the page that not use the gallery.

    It's possible not load this file?

    PS: some plugin that use shortcode use for this check the has_shortcode function

    http://wordpress.org/plugins/jsj-gallery-slideshow/

  2. Jorge Silva-Jetter
    Member
    Plugin Author

    Posted 1 year ago #

    Can you be a bit more specific about what the issue is. Which JS files are we talking about here? Can you explain the has_shortcode function and how it's relevant to this? I'm sorry but I don't understand the relationship between the shortcode and the JS file. That'd be great!

    I'm always happy to optimize the plugin and try to make it better! Thanks for the comment.

  3. The plugin load the js in the home page or page that not have the gallery shortcode.
    With has_shortcode you can check if the post content have the shortcode and load the js file only on the page that needed.

  4. Jorge Silva-Jetter
    Member
    Plugin Author

    Posted 1 year ago #

    I think this would be more of a setting that you would turn on/off because you might want to use the plugin without the short code, or with the shortcode in your template and not your content, or you might have AJAX functionality on your site (like my site has). In all these cases, it might be hard to effectively and elegantly include these scripts only as necessary.

    I think the way it would work is that this would be turned off by default (to avoid problems for less tech-savvy users), but you could turn it on. It would read something like:

    "If you are only using this plugin for galleries in your main content and are not using Javascript, you should turn on this feature in order to include javascript files only when necessary."

    ...something like that.

    What do you think?

    Like I mentioned in the other thread, this will probably make it to the next revision, in a few weeks.

    Thanks for the suggestions?

  5. Jorge Silva-Jetter
    Member
    Plugin Author

    Posted 1 year ago #

    This feature is in the new version of the plugin. There is an advanced option for it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.