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

How to add additional JavaScript code [duplicate]

Technically yes, you can add those lines to your header.php file just after the wp_head() function and it’ll load the jQuery from a remote source, just like it was on your local machine. If you want to do it properly, take a look at http://codex.wordpress.org/Function_Reference/wp_enqueue_script which will allow you to add it through the wp_head() … Read more

I keep getting Javascript error messages

You have a LOT of plugins on your blog with associated javascript files. The chance that two are conflicting is always present, so you could try and disable the plugins and then enable then one by one (beginning with the most important ones) until you find the one that’s generating errors. That way you can … Read more

WordPress Theme – jQuery JavaScript Library Issue

Not entirely sure what you’re asking but you have to include and register scripts and then enqueue what you require like:- <?php wp_enqueue_script(‘jquery’); ?> (Place immediately before <?php wp_head(); ?>). Which is included with WordPress incidentally. You can read more on wp_enqueue_script for more information on how to use this in your theme. Edit An … Read more

Loaded JavaScript file not showing [duplicate]

If the files show up in the html source then there is something wrong with your javascript (it may even be as simple as missing a semicolon in the wrong place). Without further information we can’t help you. Beware that wordpress loads jquery in no conflict mode so the function call is jQuery() and not … Read more

Trigger a function during onload

Enqueue your script only when the page you want it on is requested: function wpa_script() { if( is_page( ‘global-network’ ) ){ wp_enqueue_script( ‘wpa_script’, get_template_directory_uri() . ‘/js/my_worldmap.js’, array(‘jquery’) ); } } add_action( ‘wp_enqueue_scripts’, ‘wpa_script’ ); See is_page() in Codex.