Solved

Using wp_enqueue_script in a wordpress plugin

Posted on 2014-11-26
3
87 Views
Last Modified: 2014-12-06
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
Comment
Question by:Andreas Lazarou
  • 2
3 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
Comment Utility
Sure, just put all of it in a new .js file and call that with wp_enqueue_script()
0
 

Author Comment

by:Andreas Lazarou
Comment Utility
I create the file script.js and i added all the code.

Can you give me an example of the call please?
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
Comment Utility
<?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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
keep user input in fields after unsuccessful form submission 2 23
php image upload 3 24
html input clean up 3 28
sql sentence 2 10
In Part I (http://www.experts-exchange.com/Web_Development/Blogs/WordPress/A_8410-Getting-Started-In-WordPress-Part-I.html), I introduced you to the powerful WordPress backend, the WordPress administrative Dashboard.  In Part II, I will introduce yo…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
The viewer will learn how to count occurrences of each item in an array.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now