JavaScript file successfully registered but does not render correctly

You were using action to enqueue script, instead you need to use filter hook. As, you are adding a new script to the scripts call. However, if you used action hook for the wp_head call it works there. <?php add_filter(‘wp_enqueue_scripts’, ‘colorboxJS’); function colorboxJS() { wp_enqueue_script( ‘colorbox’, get_stylesheet_directory_uri() . ‘/colorboxJSfile.js’, array(‘jquery’) ); } ?>

JavaScript errors

Try & paste this below code your active theme functions.php file add_action( ‘wp_enqueue_scripts’, ‘load_jquery_fix’, 100 ); function load_jquery_fix() { if ( ! is_admin() ) { wp_deregister_script( ‘jquery’ ); wp_register_script( ‘jquery’, ( “//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js” ), false, ‘1.11.3’ ); wp_enqueue_script( ‘jquery’ ); } }

JavaScript: TypeError: xyz is not a function after upgrading WordPress

According to @fuxia comment: Solution is removing jQuery included by WordPress just before register/enqueue custom jQuery (see https://stackoverflow.com/a/27048128). So if you include some jQuery on your own, then add wp_dequeue_script(‘jquery’); wp_deregister_script(‘jquery’); just before register/enqueue custom jQuery script in wp_enqueue_scripts action. Or if you want jQuery included by WordPress just remember, that it’s in no-conflict mode … Read more

convertEntities() used before it is defined

The convertEntities function was defined in utils.js, but if you use script concatenation this file would be included after it is needed. Because it was in a try-catch clause, the error was not (always) noticed. The solution is to include the convertEntities function before this code is loaded. In WordPress 3.1 this is now included … Read more

PHP or JS for header image rotator?

Using PHP sends less code to the end user. (a single img tag instead of all the javascript logic). If you enable browser caching settings correctly (try W3 Total Cache), once the end user has “seen” all the images, those will all be in their cache, so on the “long tail” JavaScript vs. PHP solution … Read more

custom page url slug needs illegal ?id=1 for javascript

Here’s a potential solution using the page_link filter and testing for the presence of a meta key to add a query arg: function wpa84303_page_query_arg( $permalink, $page, $sample ) { if( $query_arg = get_post_meta( $page, ‘query_arg’, true ) ) $permalink = add_query_arg( ‘id’, ‘0’, $permalink ); return $permalink; } add_filter( ‘page_link’, ‘wpa84303_page_query_arg’, 10, 3 ); Add … Read more