dwkelley
Forum Replies Created
-
Forum: Localhost Installs
In reply to: Custom Javascript to run on one page onlySorry for the very delayed response – still not able to get this to work. We’ve just moved on to working on some other things for the time being. Hoping to test some more possible solutions this week that we’ve compiled online. This is the example code that the developer provides in the files:
<script type='text/javascript' src='bug-min.js'></script> <script type='text/javascript'> // default fruit fly bug: new BugController({ }); // default spiders: new SpiderController({ }); </script>We did try adding this a couple of different ways on the page that we’d like it to run on, but it hasn’t worked yet. We were wondering if perhaps we are not linking the source correctly since it’s local.
- This reply was modified 6 years, 9 months ago by Steven Stern (sterndata).
Forum: Localhost Installs
In reply to: Custom Javascript to run on one page onlyHere is the code:
function wpfor_enqueue() { $myrequiredpage = 5; if ( $myrequiredpage == get_the_ID() ) wp_enqueue_script('my_bugs_script', get_stylesheet_directory_uri() . '/js/bugs-min.js') } } add_filter( 'wp_enqueue_scripts', 'wpfor_enqueue');We used get_stylesheet_directory instead because of it being a child theme which I believe is correct? Not terribly familiar with PHP either unfortunately but trying to learn more.
- This reply was modified 6 years, 9 months ago by Steven Stern (sterndata).
Forum: Localhost Installs
In reply to: Custom Javascript to run on one page onlyThank you! – we did try this and getting a parsing error for this:
syntax error, unexpected ‘}’