1<img src="<?php echo get_template_directory_uri(); ?>/images/logo.png" width="" height="" alt="" />
2
1// Get template directory example:
2<img src="<?php echo get_template_directory_uri(); ?>/images/logo.png" />
3
4// If you use child theme you will have to use another function:
5<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/logo.png" />
6
1/**
2 * Enqueue scripts and styles.
3 */
4function wpdocs_theme_slug_scripts() {
5 // Custom scripts require a unique slug (Theme Name).
6 wp_enqueue_script( 'theme-slug-custom-script', get_template_directory_uri() . '/js/custom-script.js', array(), '1.0.0', true );
7
8 /*
9 * To avoid double loading Genericons will not need a slug. Same applies
10 * to all other non-custom styles or scripts.
11 */
12 wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '1.0.0' );
13}
14add_action( 'wp_enqueue_scripts', 'wpdocs_theme_slug_scripts' );
15
1function get_template_directory_uri() {
2 $template = str_replace( '%2F', '/', rawurlencode( get_template() ) );
3 $theme_root_uri = get_theme_root_uri( $template );
4 $template_dir_uri = "$theme_root_uri/$template";
5
6 /**
7 * Filters the current theme directory URI.
8 *
9 * @since 1.5.0
10 *
11 * @param string $template_dir_uri The URI of the current theme directory.
12 * @param string $template Directory name of the current theme.
13 * @param string $theme_root_uri The themes root URI.
14 */
15 return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );
16}
17