I wrote a plugin but it keeps adding custom javascript into section not into section of every page. Can anyone help me or give me a hint how to add js into section?
public constructor {
add_action( 'init', array( $this, 'custom_js_register' ) );
add_action( 'wp_head', array( $this, 'custom_js_print' ) );
}
function custom_js_register() {
wp_register_script('custom_button', 'http://xxx.xxx.xxx/js/Button.js');
}
function custom_js_print() {
wp_enqueue_script('custom_button');
}
also instead of just loading js, I want to be able to do something like this.
<script type="text/javascript" src="http://xxx.xxx.xxx/js/Button.js" charset="UTF-8">
</script>