Get file headers in custom file
in my one of my plugins i have modules (kind of like plugins in a plugin), is there a function like get_plugin_data()
or wp_get_theme()
that will allow me to get the header section of a custom file (by passing the path as a parameter)?
By heading section i mean
/*
Plugin Name: Name Of The Plugin
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A brief description of the Plugin.
Version: The Plugin's Version Number, e.g.: 1.0
Author: Name Of The Plugin Author
Author URI: http://URI_Of_The_Plugin_Author
License: A "Slug" license name e.g. GPL2
*/
Thanks to @toscho the correct solution was
$default_headers = array(
'Module Name' = 'Module Name',
'Test Header' = 'Test Header',
);
$file_data = get_file_data(dirname(__file__).'/some-file.php', $default_headers);
print_r($file_data);
Topic wp-get-theme get-plugin-data headers plugin-development theme-development Wordpress
Category Web