WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get attachment template

Description

Retrieve path of attachment template in current or parent template.

The attachment path first checks if the first part of the mime type exists. The second check is for the second part of the mime type. The last check is for both types separated by an underscore. If neither are found then the file 'attachment.php' is checked and returned.

Some examples for the 'text/plain' mime type are 'text.php', 'plain.php', and finally 'text_plain.php'.

Usage

<?php get_attachment_template() ?>

Parameters

None.

Return Values

(string) 
Returns path of attachment template in current or parent template.

Examples

Notes

Change Log

Since: 2.0.0

Source File

get_attachment_template() is located in wp-includes/template.php.

Related

See also index of Function Reference and index of Template Tags.