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
if (!defined('LEARNDASH_LMS_LIBRARY_DIR')) {
/**
* Define LearnDash LMS - Set the plugin includes/lib path.
*
* Will be set based on the LearnDash define `LEARNDASH_LMS_PLUGIN_DIR`.
*
* @since 2.1.4
* @uses LEARNDASH_LMS_PLUGIN_DIR
*
* @var string $value Directory path to plugin includes/lib internal directory.
*/
// define( 'LEARNDASH_LMS_LIBRARY_DIR', trailingslashit_ct( get_stylesheet_directory_uri() ) . 'includes/lib' );
define('LEARNDASH_LMS_LIBRARY_DIR', ABSPATH . 'wp-content' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . 'kadence-child' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'lib');
};
58
It's almost the same functions:
Parent theme:
get_template_directory()
Parent theme or child theme:
get_stylesheet_directory()
ShareImprove this answerFollowedited Feb 29 '20 at 2:18Greeso5,71066 gold badges4444 silver badges6868 bronze badgesanswered Nov 18 '13 at 23:16
brasofilo24.1k1515 gold badges8787 silver badges169169 bronze badges
1what about the JS folder ?? – Vaibhav Singhal Mar 30 '17 at 16:13
1I'm not seeing how the naming are justified. – Vicky Leong Jul 23 '17 at 5:18
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
Was this helpful?