Fix single image size.

This commit is contained in:
Hoang Huu 2019-10-31 14:11:53 +07:00
parent a1e0f7b4ab
commit 8d86aa767d
2 changed files with 13 additions and 12 deletions

View File

@ -2,7 +2,8 @@
<?php
global $property;
$galleries = $property->get_gallery();
$image_size = opalestate_get_option( 'opalestate_thumbnail_size', 'medium' );
$thumb_image_size = opalestate_get_option( 'opalestate_thumbnail_size', 'medium' );
$single_image_size = opalestate_get_option( 'featured_image_size', 'full' );
if ( isset( $galleries ) && $galleries ):
?>
@ -46,13 +47,13 @@
<div class="swiper-wrapper opalestate-gallery">
<?php if ( has_post_thumbnail() ): ?>
<div class="swiper-slide">
<?php the_post_thumbnail( opalestate_get_option( 'featured_image_size', 'full' ) ); ?>
<?php the_post_thumbnail( $single_image_size ); ?>
</div>
<?php endif; ?>
<?php if ( isset( $galleries ) && is_array( $galleries ) && $galleries ): ?>
<?php foreach ( $galleries as $key => $src ): ?>
<div class="swiper-slide">
<img src="<?php echo esc_url( wp_get_attachment_image_url( $key, 'full' ) ); ?>" alt="gallery">
<img src="<?php echo esc_url( wp_get_attachment_image_url( $key, $single_image_size ) ); ?>" alt="gallery">
</div>
<?php endforeach; ?>
<?php endif; ?>
@ -77,14 +78,14 @@
<?php if ( has_post_thumbnail() ):
?>
<div class="swiper-slide">
<div style="background-image:url('<?php echo wp_get_attachment_thumb_url( get_post_thumbnail_id(), $image_size ); ?>');" class="thumb-nav"></div>
<div style="background-image:url('<?php echo wp_get_attachment_thumb_url( get_post_thumbnail_id(), $thumb_image_size ); ?>');" class="thumb-nav"></div>
</div>
<?php endif; ?>
<?php if ( isset( $galleries ) && is_array( $galleries ) && $galleries ): ?>
<?php foreach ( $galleries as $key => $src ): ?>
<div class="swiper-slide">
<div style="background-image:url('<?php echo wp_get_attachment_image_url( $key, $image_size ); ?>');" class="thumb-nav"></div>
<div style="background-image:url('<?php echo wp_get_attachment_image_url( $key, $thumb_image_size ); ?>');" class="thumb-nav"></div>
</div>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -4,8 +4,8 @@
global $property;
$galleries = $property->get_gallery();
$single_image_size = opalestate_get_option( 'featured_image_size', 'full' );
$image_size = opalestate_get_option( 'opalestate_thumbnail_size' );
if ( ! empty( $galleries ) && isset( $galleries ) ):
?>
<?php
@ -32,12 +32,12 @@
<div class="swiper-wrapper">
<?php if ( has_post_thumbnail() ): ?>
<div class="swiper-slide"><?php the_post_thumbnail( opalestate_get_option( 'featured_image_size', 'full' ) ); ?></div>
<div class="swiper-slide"><?php the_post_thumbnail( $single_image_size ); ?></div>
<?php endif; ?>
<?php if ( isset( $galleries ) && is_array( $galleries ) ): ?>
<?php foreach ( $galleries as $key => $src ): ?>
<div class="swiper-slide"><img src="<?php echo esc_url( wp_get_attachment_image_url( $key, 'full' ) ); ?>" alt="gallery"></div>
<div class="swiper-slide"><img src="<?php echo esc_url( wp_get_attachment_image_url( $key, $single_image_size ) ); ?>" alt="gallery"></div>
<?php endforeach; ?>
<?php endif; ?>
@ -48,7 +48,7 @@
<?php if ( has_post_thumbnail() ): ?>
<div class="property-thumbnail">
<?php the_post_thumbnail( 'full' ); ?>
<?php the_post_thumbnail( $single_image_size ); ?>
</div>
<?php endif; ?>
<?php endif; ?>