<?php /** * Template part for displaying a post's featured image * * @package kadence */ namespace Kadence; // Audio or video attachments can have featured images, so they need to be specifically checked. $support_slug = get_post_type(); if ( 'attachment' === $support_slug ) { if ( wp_attachment_is( 'audio' ) ) { $support_slug .= ':audio'; } elseif ( wp_attachment_is( 'video' ) ) { $support_slug .= ':video'; } } if ( post_password_required() || ! post_type_supports( $support_slug, 'thumbnail' ) || ! has_post_thumbnail() ) { return; } if ( is_singular( get_post_type() ) ) { ?> <div class="post-thumbnail article-post-thumbnail kadence-thumbnail-position-<?php echo esc_attr( kadence()->get_feature_position() ); ?><?php echo ( 'behind' === kadence()->get_feature_position() ? ' align' . esc_attr( kadence()->option( 'post_feature_width', 'wide' ) ) : '' ); ?> kadence-thumbnail-ratio-<?php echo esc_attr( kadence()->option( $support_slug . '_feature_ratio', '2-3' ) ); ?>"> <div class="post-thumbnail-inner"> <?php the_post_thumbnail( apply_filters( 'kadence_single_featured_image_size', 'full' ), array( 'class' => 'post-top-featured') ); ?> </div> </div><!-- .post-thumbnail --> <?php if ( 'behind' !== kadence()->get_feature_position() && kadence()->option( $support_slug . '_feature_caption', false ) ) { $caption = get_the_post_thumbnail_caption(); if ( ! empty( $caption ) ) { echo '<div class="article-post-thumbnail-caption content-bg">' . wp_kses_post( $caption ) . '</div>'; } } ?> <?php do_action( 'kadence_single_after_featured_image' ); ?> <?php } else { ?> <a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true"> <div class="post-thumbnail-inner"> <?php global $wp_query; $thumbnail_id = get_post_thumbnail_id(); $alt = get_post_meta( $thumbnail_id, '_wp_attachment_image_alt', true ); if ( 0 === $wp_query->current_post ) { the_post_thumbnail( 'post-thumbnail', array( 'class' => 'post-top-featured', 'alt' => ! empty( $alt ) ? $alt : the_title_attribute( array( 'echo' => false, ) ), ) ); } else { the_post_thumbnail( 'post-thumbnail', array( 'alt' => ! empty( $alt ) ? $alt : the_title_attribute( array( 'echo' => false, ) ), ) ); } ?> </div> </a><!-- .post-thumbnail --> <?php do_action( 'kadence_loop_after_featured_image' ); ?> <?php }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
archive.php | File | 1.33 KB | 0644 |
|
archive_header.php | File | 1002 B | 0644 |
|
archive_hero.php | File | 1.13 KB | 0644 |
|
comments-list.php | File | 1.03 KB | 0644 |
|
entry-attachment.php | File | 4.13 KB | 0644 |
|
entry.php | File | 603 B | 0644 |
|
entry_actions.php | File | 1.02 KB | 0644 |
|
entry_author.php | File | 2.44 KB | 0644 |
|
entry_content.php | File | 825 B | 0644 |
|
entry_footer.php | File | 335 B | 0644 |
|
entry_header.php | File | 1.15 KB | 0644 |
|
entry_hero.php | File | 1.46 KB | 0644 |
|
entry_loop_footer.php | File | 261 B | 0644 |
|
entry_loop_header.php | File | 397 B | 0644 |
|
entry_loop_meta.php | File | 12.29 KB | 0644 |
|
entry_loop_taxonomies.php | File | 1.61 KB | 0644 |
|
entry_loop_thumbnail.php | File | 1.94 KB | 0644 |
|
entry_loop_title.php | File | 673 B | 0644 |
|
entry_meta.php | File | 11.23 KB | 0644 |
|
entry_related.php | File | 2.95 KB | 0644 |
|
entry_summary.php | File | 1007 B | 0644 |
|
entry_tags.php | File | 712 B | 0644 |
|
entry_taxonomies.php | File | 1.56 KB | 0644 |
|
entry_thumbnail.php | File | 2.43 KB | 0644 |
|
entry_title.php | File | 254 B | 0644 |
|
error-404.php | File | 655 B | 0644 |
|
error-500.php | File | 789 B | 0644 |
|
error-offline.php | File | 575 B | 0644 |
|
error.php | File | 1.05 KB | 0644 |
|
page_header.php | File | 1.26 KB | 0644 |
|
pagination.php | File | 697 B | 0644 |
|
single-entry.php | File | 2.58 KB | 0644 |
|
single.php | File | 1 KB | 0644 |
|