I have had a look at the source code of Wordpress, as well as php.net for a possible answer. However, I was not able to get close to finding it.
For the source code, I was assuming I would find it in one of the many files I checked in the wp-includes folder. However, there are way! to many files to look through.
What I want to know if how does Wordpress manage to get Theme/Plugin/Template name and other information from the headers of the specific files? If it were XML data or PHP variables, it would make sense. However the data is places in PHP Comments! How does one read comments?
/* Theme Name: Twenty Sixteen Theme URI: https://wordpress.org/themes/twentysixteen/ Author: the WordPress team Author URI: https://wordpress.org/ Description: Twenty Sixteen is a modernized take on an ever-popular WordPress layout Version: 1.2 License: GNU General Public License v2 or later Text Domain: twentysixteen */
One question here on StackOverflow suggested the use of
getDocComment() however now another question comes to me mind, first, how do we only get a specific block of comments?
Even if we manage to get all the content of the comment, how do we manage to get the "Theme Name" into a variable and so on?