Adding a GitHub plugin that uses JS – please help
-
Hi there,
I’m having trouble implementing this and am hoping someone can help me figure out what I’m doing wrong. I’ve been using WP for 10+ years, but I’m not a coder, so please bear with me.
I’m looking at this plugin on GitHub.
https://github.com/PCaponetti/jquery.slotMachineI uploaded the JS files to my server, and using the Header and Footer Scripts plugin (https://wordpress.org/plugins/header-and-footer-scripts/), I added the following code to the header.
<link rel="stylesheet" type="text/css" href="wp-includes/css/slot-machine-main.css" /> <script type="text/javascript" src="wp-includes/js/pcaponetti-slot-machine/jquery-1.6.2.min.js"></script> <script type="text/javascript" src="wp-includes/js/pcaponetti-slot-machine/jquery.slotMachine-0.5.1.js"></script> <script type="text/javascript" src="wp-includes/js/pcaponetti-slot-machine/main.js"></script>
I then created a list, per the info on GitHub.
<div id="roller1"> <ul> <li>tiny</li> <li>little</li> <li>pocket-sized</li> <li>pretty</li> </ul> <ul> <li>fluffy</li> <li>snuggly</li> <li>baby</li> <li>lovey</li> </ul> <ul> <li>bunny</li> <li>puppy</li> <li>kitten</li> <li>turtle</li> </ul> </div> <div style="clear: both;"> </div> <br /> <div id="btn_shake" class="button"> Spin!</div> <div style="clear: both"> </div>
When I put the list in the sidebar (as a test), it works perfectly. 🙂
However, I want to be able to use this code in a post, utilizing the same JS code but a different list each time.
When I put the list in a post, it just shows up as a list and doesn’t do anything. Interestingly, the sidebar that works on the home page no longer works once I navigate to the post; it winds up looking just like a list again.
I’ve reviewed the WP codex on JS (https://codex.wordpress.org/Using_Javascript, but I don’t really understand it.
Does anyone know what I could be doing wrong? I’m pulling my hair out. lol
Any help or insight would be greatly appreciated.
Thank you kindly in advance for your time and assistance.
- The topic ‘Adding a GitHub plugin that uses JS – please help’ is closed to new replies.