前回の。
いろいろ試して、まあまあぼちぼちて感じ。
wp-include/theme-compatに本体のembed-content.phpがあるので、wp-content/theme以下にそれをコピーしてからいぢる必要がある。
wp-includeはwordpressの更新の度にぶち消されるので。
あとは中身を見て、適当に組み替えたりCSSを組み込んでそれを変更したり。
デザインはもうちょっと良くしたいが、結局使うのかコレといった具合。
使い方を考えていきたいねえ。
embed-content.phpはこんな感じにした。
<?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 an embed-content.php template.
*
* @package WordPress
* @subpackage Theme_Compat
* @since 4.5.0
*/
?>
<style>
.wp-embed {
width: 95%;
height: 95%;
max-width: 750px;
padding: 10px;
border: none;
}
.wp-embed-featured-image img {
object-fit: cover;
width: 80px;
height: 80px;
}
p.wp-embed-heading {
font-size: 14px;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.wp-embed-excerpt {
font-size: 11px;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.wp-embed-site-icon {
width: 12px;
height: 12px;
}
.wp-embed-site-title a {
padding-left: 15px;
font-size: 10px;
}
.wp-embed-footer {
display: table;
width: 100%;
margin :0px;
}
</style>
<div <?php post_class('wp-embed'); ?>>
<?php
/**
* Filters the thumbnail image ID for use in the embed template.
*
* @since 4.9.0
*
* @param int $thumbnail_id Attachment ID.
*/
/**
* Filters 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.
*/
/**
* Filters 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.
*/
?>
<?php /*
<div class="wp-embed-featured-image rectangular">
*/ ?>
<div class="wp-embed-featured-image square">
<a href="<?php the_permalink(); ?>" target="_top">
<img src="<?php echo catch_that_image(); ?>" alt="<?php the_title(); ?>" />
</a>
</div>
<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">
<img src="<?php echo catch_that_image(); ?>" alt="<?php the_title(); ?>" />
</a>
</div>
<?php endif; ?>
<div class="wp-embed-excerpt"><?php the_excerpt_embed(); ?></div>
<?php
/**
* Prints 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
/**
* Prints additional meta content in the embed template.
*
* @since 4.4.0
*/
do_action( 'embed_content_meta' );
?>
</div>
</div>
</div>