WordPress.org

Ready to get started?Download WordPress

Codex

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

Difference between revisions of "Function Reference/get attachment template"

m
(Source File)
Line 27: Line 27:
 
== Source File ==
 
== Source File ==
 
<!-- Need links to current source code files -->
 
<!-- Need links to current source code files -->
<tt>get_attachment_template()</tt> is located in <tt>wp-includes/theme.php</tt>.
+
<tt>get_attachment_template()</tt> is located in <tt>wp-includes/template.php</tt>.
   
 
== Related ==
 
== Related ==

Revision as of 05:48, 9 January 2013

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.