-
AuthorPosts
-
February 27, 2018 at 1:54 pm #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> and
accord to instruction i must add it in the header.php, but it’s not working. Please help.Kind Regards
February 27, 2018 at 2:22 pm #918465Hey 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,
MikeFebruary 27, 2018 at 3:00 pm #918484Hi!
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,
YigitSeptember 23, 2021 at 3:01 am #1321971This reply has been marked as private.September 23, 2021 at 1:00 pm #1322014Hi,
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,
MikeSeptember 23, 2021 at 3:15 pm #1322036Hi 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!
September 24, 2021 at 12:14 pm #1322195Hi,
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,
MikeSeptember 27, 2021 at 12:08 am #1322388This reply has been marked as private.September 27, 2021 at 2:25 pm #1322499Hi,
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,
MikeSeptember 28, 2021 at 1:00 am #1322549Thank you for helping to get this to work!
September 28, 2021 at 12:06 pm #1322615Hi,
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 -
AuthorPosts
- The topic ‘Adding custom javascrtip to Enfold's Theme header.’ is closed to new replies.