Get file headers in custom file

Use get_file_data( $file, $headers ): $file_data = get_file_data( __FILE__, array ( ‘Plugin Name’ ) ); echo “the name is ” . $file_data[0]; Make sure the first parameter points to an existing file. It will find all lines that are formatted like regular plugins headers or the headers of a style.css. In my plugin T5 Opera … Read more

Get Parent Theme Author Name

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 … Read more