diff --git src/wp-includes/embed-template.php src/wp-includes/embed-template.php index fab8c84..ae72352 100644 --- src/wp-includes/embed-template.php +++ src/wp-includes/embed-template.php @@ -10,193 +10,20 @@ * @since 4.4.0 */ -if ( ! headers_sent() ) { - header( 'X-WP-embed: true' ); -} +get_header( 'embed' ); -?> - - class="no-js"> - - <?php echo wp_get_document_title(); ?> - - tag. - * - * @since 4.4.0 - */ - do_action( 'embed_head' ); - ?> - -> - $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 ); - } - ?> -
> - - - - -

- - - -

- - - - -
- - - - -
- -
-

-
-

- ' . esc_html( get_bloginfo( 'name' ) ) . '' - ); - ?> -

-
+else : - -
- - - +get_footer( 'embed' ); diff --git src/wp-includes/embed.php src/wp-includes/embed.php index 17b9ac4..b0711de 100644 --- src/wp-includes/embed.php +++ src/wp-includes/embed.php @@ -1045,3 +1045,108 @@ function print_embed_sharing_dialog() { $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' === $type && $shape === $type ) : ?> + + + + %s', + 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 = '
' . $site_title . '
'; + + /** + * 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 ); +} diff --git src/wp-includes/general-template.php src/wp-includes/general-template.php index 3e13925..c37b688 100644 --- src/wp-includes/general-template.php +++ src/wp-includes/general-template.php @@ -36,14 +36,21 @@ function get_header( $name = null ) { $templates = array(); $name = (string) $name; - if ( '' !== $name ) + if ( '' !== $name ) { $templates[] = "header-{$name}.php"; + } - $templates[] = 'header.php'; + if ( 'embed' === $name ) { + $backcompat_dir = ABSPATH . WPINC . '/theme-compat/embed'; + } else { + $templates[] = 'header.php'; + $backcompat_dir = ABSPATH . WPINC . '/theme-compat'; + } // Backward compat code will be removed in a future release - if ('' == locate_template($templates, true)) - load_template( ABSPATH . WPINC . '/theme-compat/header.php'); + if ( '' == locate_template( $templates, true ) ) { + load_template( $backcompat_dir . '/header.php'); + } } /** @@ -76,14 +83,21 @@ function get_footer( $name = null ) { $templates = array(); $name = (string) $name; - if ( '' !== $name ) + if ( '' !== $name ) { $templates[] = "footer-{$name}.php"; + } - $templates[] = 'footer.php'; + if ( 'embed' === $name ) { + $backcompat_dir = ABSPATH . WPINC . '/theme-compat/embed'; + } else { + $templates[] = 'footer.php'; + $backcompat_dir = ABSPATH . WPINC . '/theme-compat'; + } // Backward compat code will be removed in a future release - if ('' == locate_template($templates, true)) - load_template( ABSPATH . WPINC . '/theme-compat/footer.php'); + if ( '' == locate_template( $templates, true ) ) { + load_template( $backcompat_dir . '/footer.php' ); + } } /** @@ -166,12 +180,38 @@ function get_template_part( $slug, $name = null ) { if ( '' !== $name ) $templates[] = "{$slug}-{$name}.php"; - $templates[] = "{$slug}.php"; + if ( false === strpos( $name, 'embed' ) ) { + $templates[] = "{$slug}.php"; + } locate_template($templates, true, false); } /** + * Load an embed template part into a template + * + * @since 4.5.0 + * + * @param string $name The name of the specialised template. + */ +function get_embed_template_part( $name = 'embed' ) { + $default_template = "content.php"; + + if ( 'none' === $name ) { + $name = 'embed-none'; + $default_template = "content-none.php"; + } + + // First try to use the content-$name.php template part provided by the theme + if ( null !== get_template_part( 'content', $name ) ) { + return; + } + + // Nothing found, let's use the default output + load_template( ABSPATH . WPINC . '/theme-compat/embed/' . $default_template ); +} + +/** * Display search form. * * Will first attempt to locate the searchform.php file in either the child or diff --git src/wp-includes/theme-compat/embed/content-none.php src/wp-includes/theme-compat/embed/content-none.php index e69de29..eadcfcb 100644 --- src/wp-includes/theme-compat/embed/content-none.php +++ src/wp-includes/theme-compat/embed/content-none.php @@ -0,0 +1,39 @@ + +
+

+ +
+

+ ' . esc_html( get_bloginfo( 'name' ) ) . '' + ); + ?> +

+
+ + + + +
diff --git src/wp-includes/theme-compat/embed/content.php src/wp-includes/theme-compat/embed/content.php index e69de29..6e80bea 100644 --- src/wp-includes/theme-compat/embed/content.php +++ src/wp-includes/theme-compat/embed/content.php @@ -0,0 +1,60 @@ + +
> + + +

+ + + +

+ + + +
+ + + + +
+ + + diff --git src/wp-includes/theme-compat/embed/header.php src/wp-includes/theme-compat/embed/header.php index e69de29..a95bdb3 100644 --- src/wp-includes/theme-compat/embed/header.php +++ src/wp-includes/theme-compat/embed/header.php @@ -0,0 +1,33 @@ + + + class="no-js"> + + <?php echo wp_get_document_title(); ?> + + tag. + * + * @since 4.4.0 + */ + do_action( 'embed_head' ); + ?> + +>