123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- /**
- * Template part for displaying the content featured image.
- *
- * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
- *
- * @package Pen
- */
- if ( ! post_password_required() && ! is_attachment() && has_post_thumbnail() ) {
- $pen_post_id = get_the_ID();
- if ( is_singular() ) {
- $thumbnail_display = get_post_meta( $pen_post_id, 'pen_content_thumbnail_display_override', true );
- if ( ! $thumbnail_display || 'default' === $thumbnail_display ) {
- $thumbnail_display = pen_option_get( 'content_thumbnail_display' );
- }
- if ( $thumbnail_display && 'no' !== $thumbnail_display ) {
- $thumbnail_size = get_post_meta( $pen_post_id, 'pen_content_thumbnail_resize_override', true );
- if ( ! $thumbnail_size || 'default' === $thumbnail_size ) {
- $thumbnail_size = pen_option_get( 'content_thumbnail_resize' );
- }
- if ( 'none' === $thumbnail_size ) {
- if ( 'image' === get_post_type() ) {
- $thumbnail_size = 'large';
- } else {
- $thumbnail_size = 'medium';
- }
- }
- $animation_reveal = get_post_meta( $pen_post_id, 'pen_content_thumbnail_animation_reveal_override', true );
- if ( ! $animation_reveal || 'default' === $animation_reveal ) {
- $animation_reveal = pen_option_get( 'content_thumbnail_animation_reveal' );
- }
- $classes = trim(
- implode(
- ' ',
- array_filter(
- array(
- 'post-thumbnail',
- 'pen_thumbnail_size_' . $thumbnail_size,
- $animation_reveal ? 'pen_custom_animation_' . $animation_reveal : '',
- )
- )
- )
- );
- ?>
- <div class="<?php echo esc_attr( $classes ); ?>">
- <?php
- the_post_thumbnail( $thumbnail_size );
- ?>
- </div><!-- .post-thumbnail -->
- <?php
- }
- } else {
- $thumbnail_display = get_post_meta( $pen_post_id, 'pen_list_thumbnail_display_override', true );
- if ( ! $thumbnail_display || 'default' === $thumbnail_display ) {
- $thumbnail_display = pen_option_get( 'list_thumbnail_display' );
- }
- if ( $thumbnail_display && 'no' !== $thumbnail_display ) {
- $thumbnail_size = get_post_meta( $pen_post_id, 'pen_list_thumbnail_resize_override', true );
- if ( ! $thumbnail_size || 'default' === $thumbnail_size ) {
- $thumbnail_size = pen_option_get( 'list_thumbnail_resize' );
- }
- if ( 'none' === $thumbnail_size || 'masonry' === pen_option_get( 'list_type' ) ) {
- $thumbnail_size = 'large';
- }
- $animation_reveal = get_post_meta( $pen_post_id, 'pen_list_thumbnail_animation_reveal_override', true );
- if ( ! $animation_reveal || 'default' === $animation_reveal ) {
- $animation_reveal = pen_option_get( 'list_thumbnail_animation_reveal' );
- }
- $classes = trim(
- implode(
- ' ',
- array_filter(
- array(
- 'post-thumbnail',
- 'pen_thumbnail_size_' . $thumbnail_size,
- $animation_reveal ? 'pen_custom_animation_' . $animation_reveal : '',
- )
- )
- )
- );
- ?>
- <a class="<?php echo esc_attr( $classes ); ?>" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
- <?php
- the_post_thumbnail( $thumbnail_size );
- ?>
- </a>
- <?php
- }
- }
- }
|