Solved

Using wp_enqueue_script in a wordpress plugin

Posted on 2014-11-26
3
93 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
This video teaches users how to migrate an existing Wordpress website to a new domain.
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…

732 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