• Resolved sebastianpetrovski

    (@sebastianpetrovski)


    Hi,

    I hope you’re well ??

    Is it possible to trigger hustle pop-ups via javascript?

    It seems the wordpress theme “Laytheme” does not fire the hook Hustle is looking for, but maybe I can trigger the pop-ups manually using the custom newpageshown event that Laytheme provides?

    Please see relevant documentation here: https://laytheme.com/documentation/custom-javascript.html

    I looked for the event to call in the Hustle Documentation but I couldn’t find an answer. Is there an event I can call?

    I’m thinking it may look as simple as something like below?

    <script>
    window.laytheme.on("newpageshown", function() {
    var pageId = $("body").attr("data-id");
    if (pageId == "234") {
    if (typeof Hustle !== 'undefined') {
    Hustle.popups.show(popupID); // Replace with your actual Hustle popup ID
    }
    });
    });
    </script>
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @sebastianpetrovski,

    I hope this message finds you well.

    The following javascript can help trigger the Hustle Pop-up manually.

    let _hustle = '.module_id_1';
    HUI.popupLoad(jQuery(_hustle));

    Please make sure to update the module ID.

    Kind Regards,
    Nebu John

    Thread Starter sebastianpetrovski

    (@sebastianpetrovski)

    Hello,

    Thank you for your quick reply.

    Although it appears that HUI is not defined. Is there another object I should be referencing?

    Kind Regards,

    Sebastian

    Plugin Support Laura – WPMU DEV Support

    (@wpmudevsupport3)

    Hi @sebastianpetrovski,

    Hope this message finds you well.

    If Hustle Pop-up is not triggering using the code provided by my colleague it might be due to:

    – The code is being triggered before the hustle library
    – The hustle library is not being added

    Could you look for this library?

    hustle-ui.min.js

    It will be loaded/add in the bottom, inside the <body> element

    Let us know.

    Best regards,
    Laura

    Thread Starter sebastianpetrovski

    (@sebastianpetrovski)

    Hi,

    Thanks so much for your reply.

    You’re right the hustle library loads only if the first page visited has a pop-up active. But if the site session starts from a page without a pop-up assigned then the hustle library never loads.

    I tried manually loading the script in the footer and that got rid of the error message in the console, but the pop-up still didn’t show.

    So instead, I found a way to force the relevant pages to hard refresh so they are compatible with the hustle plugin. It makes the page load ugly, but it works.

    There’s a probably a way to integrate the theme and the plugin, but I imagine it may be a lot of work! Please let me know if I’m wrong though and if it might be as simple as directing hustle to look for the newpageshown event with an m-u plugin or something.

    In any case, thanks for your reply and I’m glad there’s a workaround.

    Take care,

    Sebastian

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @sebastianpetrovski

    Thank you for response!

    I think the workaround that you came up with should be fine for now.

    Unfortunately, the theme that you are using seems to be a premium theme so we don’t have a way to test it and check its code but from what you described – Hustle is not using any non-standard hooks so it would mean that theme is either loading scripts in some non-standard way or trying to “forcefully” skip loading scripts that it “thinks” are not used.

    In both these cases, this is something that should be addressed by theme developers, I’m afraid.

    However, are you actually sure this is theme related? I mean, did you try switching theme temporarily e.g. to Twenty Twenty-Four and testing if that same thing happens or not? Or are you using some sort of additional optimization plugin on site? There are some that attempt to unload seemingly unused plugins on “per page” basis and that could affect Hustle in case of popups that are set to trigger only by a click.

    I’m asking just to make sure that we are on the same side and if theme really is the culprit here.

    Kind regards,
    Adam

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @sebastianpetrovski

    I hope you are doing well.

    We haven’t heard from you in a while, I’ll go and mark this thread as resolved. If you have any additional questions or require further help, please let us know!

    Best Regards
    Patrick Freitas

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