Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1230613

    Hi Guys,

    Sorry to bother you but I can’t find the solution anywhere in this forum.

    I understand this:

    function addCustomScript(){
    ?>
    <script>
     
    // your code goes here
     
    </script>
    <?php
    }
    add_action('wp_head', 'addCustomScript');

    But what/ how exactly do I add instead of //your code goes here ?

    I’d like to have this script added:

    <script src=”somescriptname.js type=”text/javascript” “></script>

    When I only add this, it doesn’t work: somescriptname.js type=”text/javascript

    Best regards,

    Steven

    #1231084

    Hey Steven,

    Please try this instead:

    function addCustomScript(){
    ?>
    <script src="somescriptname.js" type="text/javascript"></script>
    <?php
    }
    add_action('wp_head', 'addCustomScript');

    Best regards,
    Rikard

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