我正在使用Essential Real Estate插件和WP All Import。启动导入我希望获得包含图像的项目,但在所有项目列表上只能看到发布缩略图。问题是我需要在图库的某个项目页面上添加缩略图。有一个自定义字段real_estate_property_gallery
,但是即使我使用它和一个值作为随机静态图像(WP All Import),我也会得到一个空图像,并且图库没有显示它。
我怎么把它放到画廊?
所有图像都存在,它们来自外部站点的URL。 gallery.php
的代码:
<?php
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
global $post;
$property_gallery = get_post_meta(get_the_ID(),ERE_MetaBOX_PREFIX . 'property_images',true);
wp_enqueue_style('owl.carousel');
wp_enqueue_script('owl.carousel');
if ($property_gallery):
$property_gallery = explode('|',$property_gallery); ?>
<div class="single-property-element property-gallery-wrap">
<div class="ere-property-element">
<div class="single-property-image-main owl-carousel manual ere-carousel-manual">
<?php
$gallery_id = 'ere_gallery-' . rand();
foreach ($property_gallery as $image):
$image_src = ere_image_resize_id($image,870,420,true);
$image_full_src = wp_get_attachment_image_src($image,'full');
if (!empty($image_src)) {
?>
<div class="property-gallery-item ere-light-gallery">
<img src="<?php echo esc_url($image_src) ?>" alt="<?php the_title(); ?>"
title="<?php the_title(); ?>">
<a data-thumb-src="<?php echo esc_url($image_full_src[0]); ?>"
data-gallery-id="<?php echo esc_attr($gallery_id); ?>"
data-rel="ere_light_gallery" href="<?php echo esc_url($image_full_src[0]); ?>"
class="zoomGallery"><i
class="fa fa-expand"></i></a>
</div>
<?php } ?>
<?php endforeach; ?>
</div>
<div class="single-property-image-thumb owl-carousel manual ere-carousel-manual">
<?php
foreach ($property_gallery as $image):
$image_src = ere_image_resize_id($image,250,130,true);
if (!empty($image_src)) { ?>
<div class="property-gallery-item">
<img src="<?php echo esc_url($image_src) ?>" alt="<?php the_title(); ?>"
title="<?php the_title(); ?>">
</div>
<?php } ?>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>