102 lines
3.4 KiB
PHP
102 lines
3.4 KiB
PHP
|
|
<?php
|
||
|
|
header('Content-Type: text/html; charset=utf-8');
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 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
|
||
|
|
*/
|
||
|
|
?>
|
||
|
|
<?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();
|
||
|
|
}
|
||
|
|
|
||
|
|
$thumbnail_id = apply_filters( 'embed_thumbnail_id', $thumbnail_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['height'] > 0 && $data['width'] / $data['height'] > $aspect_ratio ) {
|
||
|
|
$aspect_ratio = $data['width'] / $data['height'];
|
||
|
|
$measurements = array( $data['width'], $data['height'] );
|
||
|
|
$image_size = $size;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
$image_size = apply_filters( 'embed_thumbnail_image_size', $image_size, $thumbnail_id );
|
||
|
|
|
||
|
|
$shape = $measurements[0] / $measurements[1] >= 1.75 ? 'rectangular' : 'square';
|
||
|
|
|
||
|
|
$shape = apply_filters( 'embed_thumbnail_image_shape', $shape, $thumbnail_id );
|
||
|
|
}
|
||
|
|
?>
|
||
|
|
<link rel="stylesheet" type="text/css" href="<?= get_template_directory_uri() ?>/assets/css/app.css" />
|
||
|
|
<meta charset="UTF-8" />
|
||
|
|
<link rel="stylesheet" type="text/css" href="<?= get_template_directory_uri() ?>/assets/css/app-desktop.css" />
|
||
|
|
|
||
|
|
<aside class="aside-img">
|
||
|
|
<span class="aside-img__header">
|
||
|
|
<a href="<?php the_permalink(); ?>" target="_parent">
|
||
|
|
<img loading="lazy" src="<?= get_template_directory_uri() ?>/assets/img/profile-logo-100.svg" width="55" height="12" alt="">
|
||
|
|
</a>
|
||
|
|
</span>
|
||
|
|
<a href="<?php the_permalink(); ?>" class="aside-img__frame" target="_parent">
|
||
|
|
<?php echo get_the_post_thumbnail(get_post(get_the_ID()), array(782,440)); ?>
|
||
|
|
</a>
|
||
|
|
<h5>
|
||
|
|
<a href="<?php the_permalink(); ?>" class="aside-img__detail" target="_parent">
|
||
|
|
<?php the_title(); ?>
|
||
|
|
</a>
|
||
|
|
</h5>
|
||
|
|
<?php
|
||
|
|
$sub = get_secondary_title();
|
||
|
|
if (strlen($sub) != 0): ?>
|
||
|
|
<a href="<?php the_permalink(); ?>" class="aside-img__detail" target="_parent">
|
||
|
|
<?php echo get_secondary_title(); ?>
|
||
|
|
</a>
|
||
|
|
<?php endif; ?>
|
||
|
|
</aside>
|
||
|
|
<?php if(!is_amp_endpoint()): ?>
|
||
|
|
<script src="<?= get_template_directory_uri() ?>/assets/js/app-min.js?ver=2.5.14"></script>
|
||
|
|
<script>
|
||
|
|
/*(function(){
|
||
|
|
setTimeout(function(){
|
||
|
|
window.parent.document.querySelector("iframe[data-secret='"+window.location.hash.split('=')[1]+"']").setAttribute('height', document.querySelector('aside.aside-img').offsetHeight);
|
||
|
|
},800)
|
||
|
|
})();*/
|
||
|
|
</script>
|
||
|
|
<script>
|
||
|
|
function lazyloadInit() {
|
||
|
|
jQuery('img.lazyload').lazyload();
|
||
|
|
}
|
||
|
|
lazyloadInit();
|
||
|
|
</script>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php
|
||
|
|
/**
|
||
|
|
* Prints additional content after the embed excerpt.
|
||
|
|
*
|
||
|
|
* @since 4.4.0
|
||
|
|
*/
|
||
|
|
do_action( 'embed_content' );
|
||
|
|
?>
|