X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/0459461f9ea42e0b090759ff6fe5f48360bef750..refs/tags/wordpress-4.5:/wp-includes/template.php?ds=sidebyside diff --git a/wp-includes/template.php b/wp-includes/template.php index 45d1db0c..b2e4e242 100644 --- a/wp-includes/template.php +++ b/wp-includes/template.php @@ -404,6 +404,38 @@ function get_single_template() { return get_query_template( 'single', $templates ); } +/** + * Retrieves an embed template path in the current or parent template. + * + * By default the WordPress-template is returned. + * + * The template path is filterable via the dynamic {@see '$type_template'} hook, + * e.g. 'embed_template'. + * + * @since 4.5.0 + * + * @see get_query_template() + * + * @return string Full path to embed template file. + */ +function get_embed_template() { + $object = get_queried_object(); + + $templates = array(); + + if ( ! empty( $object->post_type ) ) { + $post_format = get_post_format( $object ); + if ( $post_format ) { + $templates[] = "embed-{$object->post_type}-{$post_format}.php"; + } + $templates[] = "embed-{$object->post_type}.php"; + } + + $templates[] = "embed.php"; + + return get_query_template( 'embed', $templates ); +} + /** * Retrieves the path of the singular template in current or parent template. * @@ -465,36 +497,11 @@ function get_attachment_template() { return get_query_template( 'attachment', $templates ); } -/** - * Retrieve path of comment popup template in current or parent template. - * - * Checks for comment popup template in current template, if it exists or in the - * parent template. - * - * The template path is filterable via the dynamic {@see '$type_template'} hook, - * e.g. 'commentspopup_template'. - * - * @since 1.5.0 - * - * @see get_query_template() - * - * @return string Full path to comments popup template file. - */ -function get_comments_popup_template() { - $template = get_query_template( 'comments_popup', array( 'comments-popup.php' ) ); - - // Backward compat code will be removed in a future release. - if ('' == $template) - $template = ABSPATH . WPINC . '/theme-compat/comments-popup.php'; - - return $template; -} - /** * Retrieve the name of the highest priority template file that exists. * - * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which - * inherit from a parent theme can just overload one file. + * Searches in the STYLESHEETPATH before TEMPLATEPATH and wp-includes/theme-compat + * so that themes which inherit from a parent theme can just overload one file. * * @since 2.7.0 * @@ -514,6 +521,9 @@ function locate_template($template_names, $load = false, $require_once = true ) } elseif ( file_exists(TEMPLATEPATH . '/' . $template_name) ) { $located = TEMPLATEPATH . '/' . $template_name; break; + } elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) { + $located = ABSPATH . WPINC . '/theme-compat/' . $template_name; + break; } }