Solved

Using wp_enqueue_script in a wordpress plugin

Posted on 2014-11-26
3
92 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

821 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