Codex tools: Log in
Contents |
Returns an array of information about a theme file.
<?php get_theme_data( $theme_filename ); ?>
Get the information from the theme's style.css and display the Theme Name and Author.
<?php
/*
* Assign theme folder name that you want to get information.
* make sure theme exist in wp-content/themes/ folder.
*/
$theme_name = 'twentyeleven';
/*
* Do not use get_stylesheet_uri() as $theme_filename,
* it will result in PHP fopen error if allow_url_fopen is set to Off in php.ini,
* which is what most shared hosting does. You can use get_stylesheet_directory()
* or get_template_directory() though, because they return local paths.
*/
$theme_data = get_theme_data( get_theme_root() . '/' . $theme_name . '/style.css' );
echo $theme_data['Title'];
echo $theme_data['Author'];
?>
get_theme_data() is located in wp-includes/theme.php.