如何将图库图片添加到Essential Real Estate WordPress插件的property-print.php文件中。

huangapple go评论55阅读模式
英文:

How to add the gallery images to property-print.php on Essential real Estate wordpress plugin

问题

我一直在尝试在生成的PDF上显示画廊中的图像(不仅仅是属性缩略图),但我无法做到。

我最后尝试的是这样的:


$property_gallery = ere_get_property_gallery_images();

if ( $property_gallery ) {

    echo '<div class="property-gallery">';

    foreach ( $property_gallery as $image ) {

        echo '<img src="' . $image . '" />';

    }

    echo '</div>';

}

但它只返回一个空白的PDF。

英文:

I have been trying to display the images of the gallery (not only the property thumbnail) on the pdf generated (on property-print.php template) on the print icon but i can't manage to do it.

last thing i tried was this:

&lt;?php

$property_gallery = ere_get_property_gallery_images();

if ( $property_gallery ) {

    echo &#39;&lt;div class=&quot;property-gallery&quot;&gt;&#39;;

    foreach ( $property_gallery as $image ) {

        echo &#39;&lt;img src=&quot;&#39; . $image . &#39;&quot; /&gt;&#39;;

    }

    echo &#39;&lt;/div&gt;&#39;;

}

?&gt;

But it just returns a blank pdf.

答案1

得分: 0

它返回空白的PDF,因为它发现了致命错误
请尝试以下代码:

```php
$property_gallery = get_post_meta($property_id, ERE_METABOX_PREFIX . 'property_images', true);

if ($property_gallery) :
    $property_gallery = explode('|', $property_gallery);
?>
    <div class="property-gallery">
        <?php
        $gallery_id = 'ere_gallery-' . rand();
        foreach ($property_gallery as $image) :
            $image_src = ere_image_resize_id($image, 1920, 1080, true);
            if (!empty($image_src)) {
        ?>
                <img src="<?php echo esc_url($image_src) ?>" width="1160" height="500">
            <?php } ?>
        <?php endforeach; ?>
    </div>
<?php endif; ?>
英文:

It is return blank pdf because it found fatal error
Try the following code:

&lt;?php
$property_gallery = get_post_meta($property_id, ERE_METABOX_PREFIX . &#39;property_images&#39;, true);

if ($property_gallery) :
    $property_gallery = explode(&#39;|&#39;, $property_gallery);
?&gt;
    &lt;div class=&quot;property-gallery&quot;&gt;
        &lt;?php
        $gallery_id = &#39;ere_gallery-&#39; . rand();
        foreach ($property_gallery as $image) :
            $image_src = ere_image_resize_id($image, 1920, 1080, true);
            if (!empty($image_src)) {
        ?&gt;
                &lt;img src=&quot;&lt;?php echo esc_url($image_src) ?&gt;&quot; width=&quot;1160&quot; height=&quot;500&quot;&gt;
            &lt;?php } ?&gt;
        &lt;?php endforeach; ?&gt;
    &lt;/div&gt;
&lt;?php endif; ?&gt;

huangapple
  • 本文由 发表于 2023年2月23日 23:32:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/75546962.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定