The get_file_description() WordPress PHP function retrieves the description for standard WordPress theme files.
Usage
get_file_description($file);
Example:
$description = get_file_description('archive.php'); echo $description; // Output: "Archive Template"
Parameters
$file
(string) – Required. The filesystem path or filename.
More information
See WordPress Developer Resources: get_file_description()
Examples
Get the description for the single.php
file
Get the description of the single.php
file and display it.
$single_desc = get_file_description('single.php'); echo $single_desc; // Output: "Single Post Template"
Display the description for page.php
file
Retrieve and display the description for the page.php
file.
$page_desc = get_file_description('page.php'); echo $page_desc; // Output: "Page Template"
Get the description for the header.php
file
Get the description of the header.php
file and display it.
$header_desc = get_file_description('header.php'); echo $header_desc; // Output: "Theme Header Template"
Display the description for footer.php
file
Retrieve and display the description for the footer.php
file.
$footer_desc = get_file_description('footer.php'); echo $footer_desc; // Output: "Theme Footer Template"
Get the description for the index.php
file
Get the description of the index.php
file and display it.
$index_desc = get_file_description('index.php'); echo $index_desc; // Output: "Main Index Template"