Archived topic
Trouble with Javascript for Tabs
5 replies · Started by Milo Lam on September 30, 2022
Hi, I was trying to follow this video to achieve tabs for my site. I tried adding the appropriate CSS and JS files into my child theme folder and enqueued it using the PHP code mentioned.
But not sure why it's not working. Hope someone can help, thanks.
Hi there,
We can't really help with custom solutions found in Youtube or Google here unfortunately.
Can you try to ask the author in the comment section? I believe he is quite active there.
Hey, Leo! All good no worries. I actually only wanted to ask about whether or not I added Javascript correctly for future solutions. Are all that's needed (if going the plugin-less route) to add Javascript into my site?:
1. Add the JS file to child theme directory
2. Add in PHP to enqueue the JS code
Sorry if this is still overgeneralizing. Any suggestions would be helpful. Thanks
Hi Milo,
You can add JS through a Hook Element. JS are usually add in wp_footer.
If you're adding a JS file, then enqueueing it through PHP in your child theme is correct.
Thanks guys!
You're welcome Milo!