How to Link External jQuery/Javascript files with WordPress

From the wording of your question, you must be adding scripts by writing <script> tags in your template. Add your own scripts via wp_enqueue_script() in your template’s functions.php, appropriately setting dependences on jQuery, and wp_head() will add the scripts for you. function my_scripts() { wp_enqueue_script( ‘my-sweet-script’, get_bloginfo(‘template_directory’) . ‘/script.js’, array(‘jquery’) ); } add_action(‘template_redirect’, ‘my_scripts’); See … Read more

Theme Activate Hook

I have that code here just name the file theme_activation_hook.php like on the website and copy this. <?php /** * Provides activation/deactivation hook for wordpress theme. * * @author Krishna Kant Sharma (http://www.krishnakantsharma.com) * * Usage: * ———————————————- * Include this file in your theme code. * ———————————————- * function my_theme_activate() { * // code … Read more

How to include jQuery and JavaScript files correctly?

First rule of thumb: do not deregister core-bundled scripts and replace with other versions, unless you are absolutely certain that no Theme, Plugins, or core itself will break due to the version change. Really, unless you absolutely need an alternate version of a core-bundled script, just use what is bundled with core. Second, I strongly … Read more

Minimum Template Files for Theme Development

To have the theme listed: style.css With at minimum this: /* Theme Name: Minimum Theme Description: Test Author: Test Version: 1.0 */ For the theme to be functional: index.php index.php must have a post loop, so this would be the bare minimum functional index.php <html> <head><?php wp_head(); ?></head> <body> <?php if ( have_posts() ) { … Read more