Get Parent Theme Author Name

I want to to get the Author name of the Parent theme.

I can get the theme name using wp_get_theme() to get the theme object of the current (child) theme. From this I can get the parent theme name.

Next I think I need to get the object of the parent theme, but unsure how best to approach this. Here is my code so far:

$style_parent_theme = wp_get_theme();
$style_parent_theme_dir = $style_parent_theme->get( 'Template' );
$style_parent_theme_name = wp_get_theme($parent_theme_dir);
$style_parent_theme_author = $style_parent_theme_name->get( 'Author' );

if ($style_parent_theme_author == "WooThemes") {

6 Answers
6

Thanks for all the help which pointed me in the right direction. In the end I used the following:

$style_parent_theme = wp_get_theme(get_template());
$style_parent_theme_author = $style_parent_theme->get( 'Author' );

I use get_template() to recover the folder name of the parent theme.

wp_get_theme then get’s the theme object.

Once we have that we can manipulate the object to get the author name.

Leave a Comment