OK, I was having this issues in another thread, but I didn’t really know how to ask the right question. I figured out my beef with scripts and plug-ins that are not specially made for WP. Many times it requires a block of js code in the HTML file…right? And for some reason, for me, that seems to screw things up. The answer I guess would be to put it in the functions.php file, but I can never seem to touch that file without screwing it up.
I’m wondering how your theme is set up? Only in very rare circumstances should you be inserting JS through a Post or Page. You should be editing your theme (most likely the header.php) to include JS files.
not in a post/page…Sometimes you need to enter script tags in the header.php file and then add a block of code (even though it’s already linking to an external js file) in the head tag or right after the footer tage. Does that make sense?
I was doing that a lot when I was building site with Dreamweaver.
I entered the external js in a script tag in the head, and then that block of code at the bottom, right before the closing body tag….that’s the way they have it in their example. It didn’t work. Could it have been conflicting with something in the functions.php file? I’m not touching that. When it comes to js I only copy and paste.
I have since found a WP plugin for this behavior, but would still like to know how to deal with these non-WP plug-ins.
if you are not using wp_enqueue_script to include your scripts then you are doing it wrong. Just make a backup copy of the functions.php file that way if you screw it up, you can always fix it. Not using the wp_enqueue_script can mess up other plugins. There is a reason the function does exist. If you are going to mess with WordPress, then you must get comfortable messing with the functions.php. Just go all the way to the bottom of the file and start your custom stuff.
Viewing 12 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic.
*May or may not contain any actual "CSS" or "Tricks".