Take your website
To the next level
Discover our newly launched customization services and elevate your web projects to new heights.
Delegate tasks, save time, and unlock the power of professional WordPress outsourcing.

Okay
  Public Ticket #1075965
How to add cross-site external js script?
Closed

Comments

  •  2
    alexeyt777 started the conversation

    I need to include this script on each page. Is it possible?

    <script crossorigin="anonymous" async type="text/javascript" src="//api.pozvonim.com/widget/callback/v3/***/connect" id="check-code-pozvonim" charset="UTF-8"></script>


  •  7,120
    Oliver replied

    HI!

    You can add it in the header.php file, in the theme folder, it's template, just copy it to the child theme.

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  •  2
    alexeyt777 replied

    I have multisite wp and are going in future start another site with you theme. So it is not desired for me to modify child theme with site specific things or maintain several child themes.

    Btw you have Theme options->General->Advanced options where I can add site specific JS and css. It works OK if I insert plain JS. But if I insert script surrounded by  <script> tags theses tags are stripped.

    Let's look on behavior of Raw JS element from Visual Composer. It puts <script> tags without any modification. So I can add internal script, external script etc without any restriction. 

    Maybe the same behavior (without restrictions and modifications) in Theme options->General->Advanced will cover more use cases and will make your theme more usable and convinient?

    Example of my code in RAW JS element:

    <script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU"></script>
    <script type="text/javascript">
    (function(){
    })();
    </script>
    
  •  7,120
    Oliver replied

    HI!

    Sorry, It's impossible to add this script in admin panel. 

    You can add it in any theme template, for example in the header.php file. (Just copy it to the child theme)

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  •  2
    alexeyt777 replied

    I've solved the problem for now. But maybe in future releases you can add this feature?

  •  7,120
    Oliver replied

    It's the first such request, but will think about it.

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver