<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[36693] trunk/src/wp-includes: Embeds: Introduce embed templates into the template hierarchy via theme-compat.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/36693">36693</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/36693","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>DrewAPicture</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-02-24 20:56:18 +0000 (Wed, 24 Feb 2016)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Embeds: Introduce embed templates into the template hierarchy via theme-compat.

Splits wp-includes/embed-template.php, introduced in 4.4, into five new templates that can be individually overridden by themes:

* embed.php
* embed-404.php
* embed-content.php
* header-embed.php
* footer-embed.php

Also introduces a new template tag for outputting the site title, `the_embed_site_title()`.

The five new templates live in theme-compat, allowing for graceful fallbacks should themes prefer not to override any or all of them.

Props swissspidy, imath, ocean90, DrewAPicture.
See <a href="https://core.trac.wordpress.org/ticket/34561">#34561</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesembedtemplatephp">trunk/src/wp-includes/embed-template.php</a></li>
<li><a href="#trunksrcwpincludesembedphp">trunk/src/wp-includes/embed.php</a></li>
<li><a href="#trunksrcwpincludesgeneraltemplatephp">trunk/src/wp-includes/general-template.php</a></li>
<li><a href="#trunksrcwpincludestemplateloaderphp">trunk/src/wp-includes/template-loader.php</a></li>
<li><a href="#trunksrcwpincludestemplatephp">trunk/src/wp-includes/template.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesthemecompatembed404php">trunk/src/wp-includes/theme-compat/embed-404.php</a></li>
<li><a href="#trunksrcwpincludesthemecompatembedcontentphp">trunk/src/wp-includes/theme-compat/embed-content.php</a></li>
<li><a href="#trunksrcwpincludesthemecompatembedphp">trunk/src/wp-includes/theme-compat/embed.php</a></li>
<li><a href="#trunksrcwpincludesthemecompatfooterembedphp">trunk/src/wp-includes/theme-compat/footer-embed.php</a></li>
<li><a href="#trunksrcwpincludesthemecompatheaderembedphp">trunk/src/wp-includes/theme-compat/header-embed.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesembedtemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/embed-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/embed-template.php  2016-02-24 19:25:29 UTC (rev 36692)
+++ trunk/src/wp-includes/embed-template.php    2016-02-24 20:56:18 UTC (rev 36693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,202 +1,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Contains the post embed template.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Back-compat placeholder for the base embed template
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * When a post is embedded in an iframe, this file is used to
- * create the output.
- *
</del><span class="cx" style="display: block; padding: 0 10px">  * @package WordPress
</span><span class="cx" style="display: block; padding: 0 10px">  * @subpackage oEmbed
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 4.4.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @deprecated 4.5.0 Moved to wp-includes/theme-compat/embed-template.php
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( ! headers_sent() ) {
-       header( 'X-WP-embed: true' );
-}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+_deprecated_file( basename( __FILE__ ), '4.5', 'wp-includes/theme-compat/embed.php' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-?>
-<!DOCTYPE html>
-<html <?php language_attributes(); ?> class="no-js">
-<head>
-       <title><?php echo wp_get_document_title(); ?></title>
-       <meta http-equiv="X-UA-Compatible" content="IE=edge">
-       <?php
-       /**
-        * Print scripts or data in the embed template <head> tag.
-        *
-        * @since 4.4.0
-        */
-       do_action( 'embed_head' );
-       ?>
-</head>
-<body <?php body_class(); ?>>
-<?php
-if ( have_posts() ) :
-       while ( have_posts() ) : the_post();
-               // Add post thumbnail to response if available.
-               $thumbnail_id = false;
-
-               if ( has_post_thumbnail() ) {
-                       $thumbnail_id = get_post_thumbnail_id();
-               }
-
-               if ( 'attachment' === get_post_type() && wp_attachment_is_image() ) {
-                       $thumbnail_id = get_the_ID();
-               }
-
-               if ( $thumbnail_id ) {
-                       $aspect_ratio = 1;
-                       $measurements = array( 1, 1 );
-                       $image_size   = 'full'; // Fallback.
-
-                       $meta = wp_get_attachment_metadata( $thumbnail_id );
-                       if ( ! empty( $meta['sizes'] ) ) {
-                               foreach ( $meta['sizes'] as $size => $data ) {
-                                       if ( $data['width'] / $data['height'] > $aspect_ratio ) {
-                                               $aspect_ratio = $data['width'] / $data['height'];
-                                               $measurements = array( $data['width'], $data['height'] );
-                                               $image_size   = $size;
-                                       }
-                               }
-                       }
-
-                       /**
-                        * Filter the thumbnail image size for use in the embed template.
-                        *
-                        * @since 4.4.0
-                        *
-                        * @param string $image_size Thumbnail image size.
-                        */
-                       $image_size = apply_filters( 'embed_thumbnail_image_size', $image_size );
-
-                       $shape = $measurements[0] / $measurements[1] >= 1.75 ? 'rectangular' : 'square';
-
-                       /**
-                        * Filter the thumbnail shape for use in the embed template.
-                        *
-                        * Rectangular images are shown above the title
-                        * while square images are shown next to the content.
-                        *
-                        * @since 4.4.0
-                        *
-                        * @param string $shape Thumbnail image shape. Either 'rectangular' or 'square'.
-                        */
-                       $shape = apply_filters( 'embed_thumbnail_image_shape', $shape );
-               }
-               ?>
-               <div <?php post_class( 'wp-embed' ); ?>>
-                       <?php if ( $thumbnail_id && 'rectangular' === $shape ) : ?>
-                               <div class="wp-embed-featured-image rectangular">
-                                       <a href="<?php the_permalink(); ?>" target="_top">
-                                               <?php echo wp_get_attachment_image( $thumbnail_id, $image_size ); ?>
-                                       </a>
-                               </div>
-                       <?php endif; ?>
-
-                       <p class="wp-embed-heading">
-                               <a href="<?php the_permalink(); ?>" target="_top">
-                                       <?php the_title(); ?>
-                               </a>
-                       </p>
-
-                       <?php if ( $thumbnail_id && 'square' === $shape ) : ?>
-                               <div class="wp-embed-featured-image square">
-                                       <a href="<?php the_permalink(); ?>" target="_top">
-                                               <?php echo wp_get_attachment_image( $thumbnail_id, $image_size ); ?>
-                                       </a>
-                               </div>
-                       <?php endif; ?>
-
-                       <div class="wp-embed-excerpt"><?php the_excerpt_embed(); ?></div>
-
-                       <?php
-                       /**
-                        * Print additional content after the embed excerpt.
-                        *
-                        * @since 4.4.0
-                        */
-                       do_action( 'embed_content' );
-                       ?>
-
-                       <div class="wp-embed-footer">
-                               <div class="wp-embed-site-title">
-                                       <?php
-                                       $site_title = sprintf(
-                                               '<a href="%s" target="_top"><img src="%s" srcset="%s 2x" width="32" height="32" alt="" class="wp-embed-site-icon"/><span>%s</span></a>',
-                                               esc_url( home_url() ),
-                                               esc_url( get_site_icon_url( 32, includes_url( 'images/w-logo-blue.png' ) ) ),
-                                               esc_url( get_site_icon_url( 64, includes_url( 'images/w-logo-blue.png' ) ) ),
-                                               esc_html( get_bloginfo( 'name' ) )
-                                       );
-
-                                       /**
-                                        * Filter the site title HTML in the embed footer.
-                                        *
-                                        * @since 4.4.0
-                                        *
-                                        * @param string $site_title The site title HTML.
-                                        */
-                                       echo apply_filters( 'embed_site_title_html', $site_title );
-                                       ?>
-                               </div>
-
-                               <div class="wp-embed-meta">
-                                       <?php
-                                       /**
-                                        * Print additional meta content in the embed template.
-                                        *
-                                        * @since 4.4.0
-                                        */
-                                       do_action( 'embed_content_meta');
-                                       ?>
-                               </div>
-                       </div>
-               </div>
-               <?php
-       endwhile;
-else :
-       ?>
-       <div class="wp-embed">
-               <p class="wp-embed-heading"><?php _e( 'Oops! That embed can&#8217;t be found.' ); ?></p>
-
-               <div class="wp-embed-excerpt">
-                       <p>
-                               <?php
-                               printf(
-                                       /* translators: %s: a link to the embedded site */
-                                       __( 'It looks like nothing was found at this location. Maybe try visiting %s directly?' ),
-                                       '<strong><a href="' . esc_url( home_url() ) . '">' . esc_html( get_bloginfo( 'name' ) ) . '</a></strong>'
-                               );
-                               ?>
-                       </p>
-               </div>
-
-               <div class="wp-embed-footer">
-                       <div class="wp-embed-site-title">
-                               <?php
-                               $site_title = sprintf(
-                                       '<a href="%s" target="_top"><img src="%s" srcset="%s 2x" width="32" height="32" alt="" class="wp-embed-site-icon"/><span>%s</span></a>',
-                                       esc_url( home_url() ),
-                                       esc_url( get_site_icon_url( 32, includes_url( 'images/w-logo-blue.png' ) ) ),
-                                       esc_url( get_site_icon_url( 64, includes_url( 'images/w-logo-blue.png' ) ) ),
-                                       esc_html( get_bloginfo( 'name' ) )
-                               );
-
-                               /** This filter is documented in wp-includes/embed-template.php */
-                               echo apply_filters( 'embed_site_title_html', $site_title );
-                               ?>
-                       </div>
-               </div>
-       </div>
-       <?php
-endif;
-
-/**
- * Print scripts or data before the closing body tag in the embed template.
- *
- * @since 4.4.0
- */
-do_action( 'embed_footer' );
-?>
-</body>
-</html>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+include( ABSPATH . WPINC . '/theme-compat/embed.php' );
</ins></span></pre></div>
<a id="trunksrcwpincludesembedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/embed.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/embed.php   2016-02-24 19:25:29 UTC (rev 36692)
+++ trunk/src/wp-includes/embed.php     2016-02-24 20:56:18 UTC (rev 36693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1046,3 +1046,29 @@
</span><span class="cx" style="display: block; padding: 0 10px">        </div>
</span><span class="cx" style="display: block; padding: 0 10px">        <?php
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Prints the necessary markup for the site title.
+ *
+ * @since 4.5.0
+ */
+function the_embed_site_title() {
+       $site_title = sprintf(
+               '<a href="%s" target="_top"><img src="%s" srcset="%s 2x" width="32" height="32" alt="" class="wp-embed-site-icon"/><span>%s</span></a>',
+               esc_url( home_url() ),
+               esc_url( get_site_icon_url( 32, admin_url( 'images/w-logo-blue.png' ) ) ),
+               esc_url( get_site_icon_url( 64, admin_url( 'images/w-logo-blue.png' ) ) ),
+               esc_html( get_bloginfo( 'name' ) )
+       );
+
+       $site_title = '<div class="wp-embed-site-title">' . $site_title . '</div>';
+
+       /**
+        * Filter the site title HTML in the embed footer.
+        *
+        * @since 4.4.0
+        *
+        * @param string $site_title The site title HTML.
+        */
+       echo apply_filters( 'embed_site_title_html', $site_title );
+}
</ins></span></pre></div>
<a id="trunksrcwpincludesgeneraltemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/general-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/general-template.php        2016-02-24 19:25:29 UTC (rev 36692)
+++ trunk/src/wp-includes/general-template.php  2016-02-24 20:56:18 UTC (rev 36693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,14 +36,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $templates = array();
</span><span class="cx" style="display: block; padding: 0 10px">        $name = (string) $name;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( '' !== $name )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( '' !== $name ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $templates[] = "header-{$name}.php";
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $templates[] = 'header.php';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        // Backward compat code will be removed in a future release
-       if ('' == locate_template($templates, true))
-               load_template( ABSPATH . WPINC . '/theme-compat/header.php');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ locate_template( $templates, true );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -76,14 +75,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $templates = array();
</span><span class="cx" style="display: block; padding: 0 10px">        $name = (string) $name;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( '' !== $name )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( '' !== $name ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 $templates[] = "footer-{$name}.php";
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $templates[] = 'footer.php';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $templates[]    = 'footer.php';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        // Backward compat code will be removed in a future release
-       if ('' == locate_template($templates, true))
-               load_template( ABSPATH . WPINC . '/theme-compat/footer.php');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ locate_template( $templates, true );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -121,9 +119,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $templates[] = 'sidebar.php';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        // Backward compat code will be removed in a future release
-       if ('' == locate_template($templates, true))
-               load_template( ABSPATH . WPINC . '/theme-compat/sidebar.php');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ locate_template( $templates, true );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcwpincludestemplateloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/template-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/template-loader.php 2016-02-24 19:25:29 UTC (rev 36692)
+++ trunk/src/wp-includes/template-loader.php   2016-02-24 20:56:18 UTC (rev 36693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -40,12 +40,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">        include( ABSPATH . 'wp-trackback.php' );
</span><span class="cx" style="display: block; padding: 0 10px">        return;
</span><span class="cx" style="display: block; padding: 0 10px"> elseif ( is_embed() ) :
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $template = ABSPATH . WPINC . '/embed-template.php';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $template = ABSPATH . WPINC . '/theme-compat/embed.php';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * Filter the template used for embedded posts.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 4.4.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @since 4.5.0 The default template path changed to wp-includes/theme-compat/embed.php
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $template Path to the template file.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span></span></pre></div>
<a id="trunksrcwpincludestemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/template.php        2016-02-24 19:25:29 UTC (rev 36692)
+++ trunk/src/wp-includes/template.php  2016-02-24 20:56:18 UTC (rev 36693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -468,8 +468,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Retrieve the name of the highest priority template file that exists.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which
- * inherit from a parent theme can just overload one file.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * 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.
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 2.7.0
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -489,6 +489,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                } elseif ( file_exists(TEMPLATEPATH . '/' . $template_name) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $located = TEMPLATEPATH . '/' . $template_name;
</span><span class="cx" style="display: block; padding: 0 10px">                        break;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                } elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) {
+                       $located = ABSPATH . WPINC . '/theme-compat/' . $template_name;
+                       break;
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcwpincludesthemecompatembed404phpfromrev36689trunksrcwpincludesembedtemplatephp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/src/wp-includes/theme-compat/embed-404.php (from rev 36689, trunk/src/wp-includes/embed-template.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/theme-compat/embed-404.php                          (rev 0)
+++ trunk/src/wp-includes/theme-compat/embed-404.php    2016-02-24 20:56:18 UTC (rev 36693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,37 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Contains the post embed content template part.
+ *
+ * When a post is embedded in an iframe, this file is used to
+ * create the content template part output if the active theme does not include
+ * a content-embed.php template.
+ *
+ * @package WordPress
+ * @subpackage Theme_Compat
+ * @since 4.5.0
+ */
+?>
+<div class="wp-embed">
+       <p class="wp-embed-heading"><?php _e( 'Oops! That embed can&#8217;t be found.' ); ?></p>
+
+       <div class="wp-embed-excerpt">
+               <p>
+                       <?php
+                       printf(
+                               /* translators: %s: a link to the embedded site */
+                               __( 'It looks like nothing was found at this location. Maybe try visiting %s directly?' ),
+                               '<strong><a href="' . esc_url( home_url() ) . '">' . esc_html( get_bloginfo( 'name' ) ) . '</a></strong>'
+                       );
+                       ?>
+               </p>
+       </div>
+
+       <?php
+       /** This filter is documented in wp-includes/theme-compat/embed-content.php */
+       do_action( 'embed_content' );
+       ?>
+
+       <div class="wp-embed-footer">
+               <?php the_embed_site_title() ?>
+       </div>
+</div>
</ins></span></pre></div>
<a id="trunksrcwpincludesthemecompatembedcontentphpfromrev36689trunksrcwpincludesembedtemplatephp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/src/wp-includes/theme-compat/embed-content.php (from rev 36689, trunk/src/wp-includes/embed-template.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/theme-compat/embed-content.php                              (rev 0)
+++ trunk/src/wp-includes/theme-compat/embed-content.php        2016-02-24 20:56:18 UTC (rev 36693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,116 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Contains the post embed content template part.
+ *
+ * When a post is embedded in an iframe, this file is used to
+ * create the content template part output if the active theme does not include
+ * a content-embed.php template.
+ *
+ * @package WordPress
+ * @subpackage Theme_Compat
+ * @since 4.5.0
+ */
+?>
+       <div <?php post_class( 'wp-embed' ); ?>>
+               <?php
+               $thumbnail_id = 0;
+
+               if ( has_post_thumbnail() ) {
+                       $thumbnail_id = get_post_thumbnail_id();
+               }
+
+               if ( 'attachment' === get_post_type() && wp_attachment_is_image() ) {
+                       $thumbnail_id = get_the_ID();
+               }
+
+               $aspect_ratio = 1;
+               $measurements = array( 1, 1 );
+               $image_size   = 'full'; // Fallback.
+
+               $meta = wp_get_attachment_metadata( $thumbnail_id );
+               if ( is_array( $meta ) ) {
+                       foreach ( $meta['sizes'] as $size => $data ) {
+                               if ( $data['width'] / $data['height'] > $aspect_ratio ) {
+                                       $aspect_ratio = $data['width'] / $data['height'];
+                                       $measurements = array( $data['width'], $data['height'] );
+                                       $image_size   = $size;
+                               }
+                       }
+               }
+
+               /**
+                * Filter the thumbnail image size for use in the embed template.
+                *
+                * @since 4.4.0
+                * @since 4.5.0 Added `$thumbnail_id` parameter.
+                *
+                * @param string $image_size   Thumbnail image size.
+                * @param int    $thumbnail_id Attachment ID.
+                */
+               $image_size = apply_filters( 'embed_thumbnail_image_size', $image_size, $thumbnail_id );
+
+               $shape = $measurements[0] / $measurements[1] >= 1.75 ? 'rectangular' : 'square';
+
+               /**
+                * Filter the thumbnail shape for use in the embed template.
+                *
+                * Rectangular images are shown above the title while square images
+                * are shown next to the content.
+                *
+                * @since 4.4.0
+                * @since 4.5.0 Added `$thumbnail_id` parameter.
+                *
+                * @param string $shape        Thumbnail image shape. Either 'rectangular' or 'square'.
+                * @param int    $thumbnail_id Attachment ID.
+                */
+               $shape = apply_filters( 'embed_thumbnail_image_shape', $shape, $thumbnail_id );
+
+               if ( 'rectangular' === $shape ) : ?>
+                       <div class="wp-embed-featured-image rectangular">
+                               <a href="<?php the_permalink(); ?>" target="_top">
+                                       <?php echo wp_get_attachment_image( $thumbnail_id, $image_size ); ?>
+                               </a>
+                       </div>
+               <?php endif; ?>
+
+               <p class="wp-embed-heading">
+                       <a href="<?php the_permalink(); ?>" target="_top">
+                               <?php the_title(); ?>
+                       </a>
+               </p>
+
+               <?php if ( 'square' === $shape ) : ?>
+                       <div class="wp-embed-featured-image square">
+                               <a href="<?php the_permalink(); ?>" target="_top">
+                                       <?php echo wp_get_attachment_image( $thumbnail_id, $image_size ); ?>
+                               </a>
+                       </div>
+               <?php endif; ?>
+
+               <div class="wp-embed-excerpt"><?php the_excerpt_embed(); ?></div>
+
+               <?php
+               /**
+                * Print additional content after the embed excerpt.
+                *
+                * @since 4.4.0
+                */
+               do_action( 'embed_content' );
+               ?>
+
+               <div class="wp-embed-footer">
+                       <?php the_embed_site_title() ?>
+
+                       <div class="wp-embed-meta">
+                               <?php
+                               /**
+                                * Print additional meta content in the embed template.
+                                *
+                                * @since 4.4.0
+                                */
+                               do_action( 'embed_content_meta');
+                               ?>
+                       </div>
+               </div>
+       </div>
+<?php
</ins></span></pre></div>
<a id="trunksrcwpincludesthemecompatembedphpfromrev36689trunksrcwpincludesembedtemplatephp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/src/wp-includes/theme-compat/embed.php (from rev 36689, trunk/src/wp-includes/embed-template.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/theme-compat/embed.php                              (rev 0)
+++ trunk/src/wp-includes/theme-compat/embed.php        2016-02-24 20:56:18 UTC (rev 36693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,23 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Contains the post embed template.
+ *
+ * When a post is embedded in an iframe, this file is used to
+ * create the output.
+ *
+ * @package WordPress
+ * @subpackage oEmbed
+ * @since 4.4.0
+ */
+
+get_header( 'embed' );
+
+if ( have_posts() ) :
+       while ( have_posts() ) : the_post();
+               get_template_part( 'embed', 'content' );
+       endwhile;
+else :
+       get_template_part( 'embed', '404' );
+endif;
+
+get_footer( 'embed' );
</ins></span></pre></div>
<a id="trunksrcwpincludesthemecompatfooterembedphpfromrev36689trunksrcwpincludesembedtemplatephp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/src/wp-includes/theme-compat/footer-embed.php (from rev 36689, trunk/src/wp-includes/embed-template.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/theme-compat/footer-embed.php                               (rev 0)
+++ trunk/src/wp-includes/theme-compat/footer-embed.php 2016-02-24 20:56:18 UTC (rev 36693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,22 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Contains the post embed footer template.
+ *
+ * When a post is embedded in an iframe, this file is used to
+ * create the footer output if the active theme does not include
+ * a footer-embed.php template.
+ *
+ * @package WordPress
+ * @subpackage Theme_Compat
+ * @since 4.5.0
+ */
+
+/**
+ * Print scripts or data before the closing body tag in the embed template.
+ *
+ * @since 4.4.0
+ */
+do_action( 'embed_footer' );
+?>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunksrcwpincludesthemecompatheaderembedphpfromrev36689trunksrcwpincludesembedtemplatephp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/src/wp-includes/theme-compat/header-embed.php (from rev 36689, trunk/src/wp-includes/embed-template.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/theme-compat/header-embed.php                               (rev 0)
+++ trunk/src/wp-includes/theme-compat/header-embed.php 2016-02-24 20:56:18 UTC (rev 36693)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,33 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Contains the post embed header template.
+ *
+ * When a post is embedded in an iframe, this file is used to
+ * create the header output if the active theme does not include
+ * a header-embed.php template.
+ *
+ * @package WordPress
+ * @subpackage Theme_Compat
+ * @since 4.5.0
+ */
+
+if ( ! headers_sent() ) {
+       header( 'X-WP-embed: true' );
+}
+
+?>
+<!DOCTYPE html>
+<html <?php language_attributes(); ?> class="no-js">
+<head>
+       <title><?php echo wp_get_document_title(); ?></title>
+       <meta http-equiv="X-UA-Compatible" content="IE=edge">
+       <?php
+       /**
+        * Print scripts or data in the embed template <head> tag.
+        *
+        * @since 4.4.0
+        */
+       do_action( 'embed_head' );
+       ?>
+</head>
+<body <?php body_class(); ?>>
</ins></span></pre>
</div>
</div>

</body>
</html>