Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #918450

    Hello,

    i wanto to add my business partner’s custom javascript module to wordpress site with Enfold Theme.
    Partner’s custom code is: <script src=”https://www.partnername.coml/ap/script.js”></script&gt; and
    accord to instruction i must add it in the header.php, but it’s not working. Please help.

    Kind Regards

    #918465

    Hey krzysztofjagusz,
    Perhaps this solution will work better for you: https://kriesi.at/support/topic/custom-js/#post-121061
    If you are still having trouble please include a admin login in the private content area so we can take a closer look.

    Best regards,
    Mike

    #918484

    Hi!

    You can alternatively try adding following code to bottom of Functions.php file in Appearance > Editor

    function my_custom_code_head(){
    ?> 
    <script src="https://www.partnername.coml/ap/script.js"></script> 
    <?php
    }
    add_action('wp_head', 'my_custom_code_head');

    Best regards,
    Yigit

    #1321971
    This reply has been marked as private.
    #1322014

    Hi,
    Thank you for your question, you would not need to change the function name my_custom_code_head, it could be anything such as my_donorbox_code, but please note that every function must have a unique name. So try adding this code to the end of your functions.php file in Appearance ▸ Editor:

    function my_custom_code_head(){
    ?> 
    <script type="text/javascript" defer src="https://donorbox.org/install-popup-button.js"></script>
    <script>window.DonorBox = { widgetLinkClassName: 'custom-dbox-popup'}</script> 
    <?php
    }
    add_action('wp_head', 'my_custom_code_head');

    Please take care when you copy & paste that the quotes do not become curly quotes which will break the code.

    Best regards,
    Mike

    #1322036

    Hi Mike,

    Thank you for your reply. I have done this and it does not appear to be working and creating the popup window that should happen when clicking the button. I have added a Donate button to the menu navigation and given it the CSS class custom-dbox-popup per the instructions from the donate platform. Nothing happens. Can you provide any additional advice?

    Thank you!

    #1322195

    Hi,
    Thanks for the feedback, is this the install info you are using: How To Create A Pop-Up Donation Form
    Can I see your site with an admin login?
    Please add to the Private Content area.

    Best regards,
    Mike

    #1322388
    This reply has been marked as private.
    #1322499

    Hi,
    Thank you for the login, the issue was that the donorbox script was looking for a link with the class custom-dbox-popup, but adding this custom class to the menu option adds the class to the menu li tag and not the a (link) tag, so I added this script to find your menu item and add the class to the correct place, your button is working now, please check.

    function my_donorbox_add_class(){
    ?> 
    <script>
    (function($) {
      $('#menu-item-6087.custom-dbox-popup a').addClass('custom-dbox-popup');
    }(jQuery));
    </script>
    <?php
    }
    add_action('wp_footer', 'my_donorbox_add_class');

    Best regards,
    Mike

    #1322549

    Thank you for helping to get this to work!

    #1322615

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Adding custom javascrtip to Enfold's Theme header.’ is closed to new replies.