get parent theme file path, get child theme file path (ok) get_template_directory_uri

get_parent_theme_file_path( '/images/svg-icons.svg' );
// '/home/admin/domains/nhungspa.com.vn/public_html/tpcn/wp-content/themes/yootheme/images/svg-icons.svg'
get_theme_file_path('/images/svg-icons.svg');
// '/home/admin/domains/nhungspa.com.vn/public_html/tpcn/wp-content/themes/yoo1/images/svg-icons.svg'
Hoặc
echo get_stylesheet_directory();
C:\xampp\htdocs\arcadia-multisite/wp-content/themes/genesis-sample
get_template_directory();
"/home/admin/domains/nhungspa.com.vn/public_html/tpcn/wp-content/themes/yootheme"
get_template_directory_uri();
'https://tpcn.nhungspa.com.vn/wp-content/themes/yootheme'
echo get_stylesheet_directory_uri();
'https://tpcn.nhungspa.com.vn/wp-content/themes/yoo1'
echo get_stylesheet_directory_uri();
http://localhost/reset/wp-content/themes/genesis-sample

Xem thêm

58

It's almost the same functions:

Add a comment8

For Retrieve Theme stylesheet directory URL:

get_theme_file_uri() oR 
get_stylesheet_directory_uri()

For Retrieve Absolute File Paths:

get_stylesheet_directory() oR 
get_theme_file_uri()

Last updated