
如何开发一款WordPress子主题
get_theme_roots ( No parameters )
get_theme_roots: 这个函数返回一个已安装的主题目录数组。这在处理子主题时很有用,因为它允许你确定父主题目录。
检索主题根。
function get_theme_roots() { global $wp_theme_directories; if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) { return '/themes'; } $theme_roots = get_site_transient( 'theme_roots' ); if ( false === $theme_roots ) { search_theme_directories( true ); // Regenerate the transient. $theme_roots = get_site_transient( 'theme_roots' ); } return $theme_roots; }