Forum Replies Created

Viewing 3 replies - 16 through 18 (of 18 total)
  • Thread Starter dwkelley

    (@dwkelley)

    Sorry 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.

    Thread Starter dwkelley

    (@dwkelley)

    Here 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.

    Thread Starter dwkelley

    (@dwkelley)

    Thank you! – we did try this and getting a parsing error for this:

    syntax error, unexpected ‘}’

Viewing 3 replies - 16 through 18 (of 18 total)