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

@ -1,8 +1,9 @@
<div class="property-preview"> <div class="property-preview">
<?php <?php
global $property; global $property;
$galleries = $property->get_gallery(); $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 ): if ( isset( $galleries ) && $galleries ):
?> ?>
@ -46,13 +47,13 @@
<div class="swiper-wrapper opalestate-gallery"> <div class="swiper-wrapper opalestate-gallery">
<?php if ( has_post_thumbnail() ): ?> <?php if ( has_post_thumbnail() ): ?>
<div class="swiper-slide"> <div class="swiper-slide">
<?php the_post_thumbnail( opalestate_get_option( 'featured_image_size', 'full' ) ); ?> <?php the_post_thumbnail( $single_image_size ); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if ( isset( $galleries ) && is_array( $galleries ) && $galleries ): ?> <?php if ( isset( $galleries ) && is_array( $galleries ) && $galleries ): ?>
<?php foreach ( $galleries as $key => $src ): ?> <?php foreach ( $galleries as $key => $src ): ?>
<div class="swiper-slide"> <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> </div>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
@ -69,22 +70,22 @@
$count_galleries = $count_galleries + count( $galleries ); $count_galleries = $count_galleries + count( $galleries );
?> ?>
<?php if ( $count_galleries > $columns ) : ?> <?php if ( $count_galleries > $columns ) : ?>
<div class="swiper-button-prev"> <i class="fas fa-angle-left"></i></div> <div class="swiper-button-prev"><i class="fas fa-angle-left"></i></div>
<div class="swiper-button-next"> <i class="fas fa-angle-right"></i></div> <div class="swiper-button-next"><i class="fas fa-angle-right"></i></div>
<?php endif; ?> <?php endif; ?>
<div class="swiper-wrapper"> <div class="swiper-wrapper">
<?php if ( has_post_thumbnail() ): <?php if ( has_post_thumbnail() ):
?> ?>
<div class="swiper-slide"> <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> </div>
<?php endif; ?> <?php endif; ?>
<?php if ( isset( $galleries ) && is_array( $galleries ) && $galleries ): ?> <?php if ( isset( $galleries ) && is_array( $galleries ) && $galleries ): ?>
<?php foreach ( $galleries as $key => $src ): ?> <?php foreach ( $galleries as $key => $src ): ?>
<div class="swiper-slide"> <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> </div>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>

View File

@ -4,8 +4,8 @@
global $property; global $property;
$galleries = $property->get_gallery(); $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 ) ): if ( ! empty( $galleries ) && isset( $galleries ) ):
?> ?>
<?php <?php
@ -32,12 +32,12 @@
<div class="swiper-wrapper"> <div class="swiper-wrapper">
<?php if ( has_post_thumbnail() ): ?> <?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 endif; ?>
<?php if ( isset( $galleries ) && is_array( $galleries ) ): ?> <?php if ( isset( $galleries ) && is_array( $galleries ) ): ?>
<?php foreach ( $galleries as $key => $src ): ?> <?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 endforeach; ?>
<?php endif; ?> <?php endif; ?>
@ -48,7 +48,7 @@
<?php if ( has_post_thumbnail() ): ?> <?php if ( has_post_thumbnail() ): ?>
<div class="property-thumbnail"> <div class="property-thumbnail">
<?php the_post_thumbnail( 'full' ); ?> <?php the_post_thumbnail( $single_image_size ); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>