Solved

Using wp_enqueue_script in a wordpress plugin

Posted on 2014-11-26
3
91 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
ID: 40468410
Sure, just put all of it in a new .js file and call that with wp_enqueue_script()
0
 

Author Comment

by:Andreas Lazarou
ID: 40468415
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
ID: 40468443
<?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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to use embargo Date/time in php 29 36
ebay devID, appID, certID, userToken 2 25
Curl & PHP Command Help 4 22
Cpanel file manager 8 22
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

785 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