Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: single_template

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
970  * @since 1.5.0
971  *
972  * @return string
973  */
974 function get_single_template() {
975      global $wp_query;
976
977      $object = $wp_query->get_queried_object();
978      $templates = array('single-' . $object->post_type . '.php', 'single.php');
979      return apply_filters('single_template', locate_template($templates));
980 }
981
982 /**
983  * Retrieve path of attachment template in current or parent template.
984  *
985  * The attachment path first checks if the first part of the mime type exists.
986  * The second check is for the second part of the mime type. The last check is
987  * for both types separated by an underscore. If neither are found then the file
988  * 'attachment.php' is checked and returned.