Add Stylesheet in head:
1 2 3 4 5 |
// Enqueue Stylesheet function help4cms_adding_custom_stylesheet() { wp_enqueue_style('custom-css', get_stylesheet_directory_uri() . '/custom-style.css', array(), '', 'all' ); } add_action('wp_enqueue_scripts', 'help4cms_adding_custom_stylesheet','0'); |
Add Script in Header:
1 2 3 4 5 6 7 8 |
/** * enqueue scripts in head */ function help4cms_adding_custom_scripts() { wp_enqueue_script( 'custom-script-one', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', false ); // placed in the head } add_action( 'wp_enqueue_scripts', 'help4cms_adding_custom_scripts' ); |
Add Script in Footer:
1 2 3 4 5 6 7 |
/** * enqueue scripts in footer */ function help4cms_adding_custom_scripts() { wp_enqueue_script( 'custom-script-two', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true ); // placed before body close tag } add_action( 'wp_enqueue_scripts', 'help4cms_adding_custom_scripts' ); |