• Resolved Abacomancer

    (@abacomancer)


    I am using a theme Zoo which loads a portfolio item only after you click on it.

    That means that any galleries of yours I include in a portfolio item will never properly load. Specifically, my problem is that because the content isn’t loaded until that click, the js that is initially loaded doesn’t include the slideshow script. I was wondering if there is an easy solution to this problem. For instance, a hook I could call in the theme’s portfolio item template to recheck the js that needs to be loaded.

    Thank you

    https://www.ads-software.com/plugins/slideshow-gallery/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tribulant Software

    (@contrid)

    @abacomancer

    Thank you for your post.

    Yes, the Slideshow Gallery uses wp_head and wp_footer functions in the theme to load it’s Javascript.

    Since those functions of yours don’t yet know that there will be a slideshow, you can call them manually in the theme’s portfolio function after the HTML has been rendered. I’m not entirely sure how your theme does it but you can do some digging in it’s functions.php file and see if it’s there and then fire this code:

    $slideshow = new Gallery();
    $slideshow -> wp_head();
    $slideshow -> wp_footer();

    Let me know if that works and helps.

    Thread Starter Abacomancer

    (@abacomancer)

    Thanks for the help. I tried the method you gave, and it mostly works.

    I had to remove the line $slideshow -> wp_head();
    I assume this is because it contains files not allowed in the body. Unfortunately, since the portfolio items are inside of an existing page, I cannot give them their own head. To add this file, I would have to somehow trigger this call in the head when a portfolio item opens.

    However, most everything for the gallery works appropriately as is (or can be fixed via styling), so I do not believe I will have to pursue that. The one problem I was having as a result of this is with ‘.slideshow-slider’. The CSS as-is without the header files forces it to width 22px with a high specificity and !important. Instead of fighting it, I just went into the files and removed the !important.

    If you have a better solution, I would be glad to hear it. Either way, I am very happy I could get this working. Thank you again for your help.

    Plugin Author Tribulant Software

    (@contrid)

    @abacomancer

    Actually, the code I gave you won’t create a header/footer.

    When the HTML of the portfolio loads, the slideshow code will generate global Javascript code.

    So when you fire $slideshow -> wp_footer() you simply echo that Javascript, nothing else.

    That is the best solution I have at the moment.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Loading js after gallery appears’ is closed to new replies.