• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 96
  • Last Modified:

Using wp_enqueue_script in a wordpress plugin

This is my current code:

<script src="http://unibet-affiliate.enetscores.com/xjs/hour/theme/affiliate/361/client"></script>
<script>
__initLivescore({"c1":"F0F0F0","c2":"BABCC3","c4":"FFFFFF","c5":"FFFFFF","c6":"C90000","affiliate_id":"0","menu":"1","sportFK":"1","odds":"decimal","lang":"3","timezone":"AUTO","selected_tab":"all"});
</script>

Open in new window


It is possible to use wp_enqueue_script for this code?

Thank you so much!
0
Andreas Lazarou
Asked:
Andreas Lazarou
  • 2
1 Solution
 
Jason C. LevineNo oneCommented:
Sure, just put all of it in a new .js file and call that with wp_enqueue_script()
0
 
Andreas LazarouMrAuthor Commented:
I create the file script.js and i added all the code.

Can you give me an example of the call please?
0
 
Jason C. LevineNo oneCommented:
<?php wp_enqueue_script('myscript', content_url('/myTheme/js/myScript.js'__FILE__)); // content_url ?>

or

<?php wp_enqueue_script('myscript', 'https://www.url/of/file/script.js'__FILE__); ?>
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now