gpt4 book ai didi

php - 动态特色图片

转载 作者:行者123 更新时间:2023-12-05 01:21:15 24 4
gpt4 key购买 nike

我最近为 wordpress 安装了动态特色图片插件。但我不知道如何链接图像。我正在尝试为自己创建一个这样的画廊 http://www.subcreative.com.au/#work - 向下滚动到项目,您将看到。

我已经把这段代码放在 functions.php 中了

<?php
while ( have_posts() ) : the_post();

if( function_exists('dfi_get_featured_images') ) {
$featuredImages = dfi_get_featured_images();

//Now, loop through the image to display
}

endwhile;
?>

并用它来链接图像。

echo ' <a class="fancybox" href="'. dfi_get_featured_images() .'" style="text-align:center">Take a look</a> '; ?>

但是当我尝试打开图像时,它变成了“/array”

最佳答案

我不是 wordpress 开发人员,但我在我试图修复的 wordpress 网站上看到了这个。所以也许你可以试试这个。

if( class_exists('Dynamic_Featured_Image') ):
global $dynamic_featured_image;
global $post;
$featured_images = $dynamic_featured_image->get_featured_images( $post->ID );

if ( $featured_images ):
?>
<?php foreach( $featured_images as $images ): ?>
<img src="<?php echo $images['full'] ?>" alt="">
<?php endforeach; ?>
<?php
endif;
endif;

这适用于我的情况。我正在使用 DFI 3.1.13

关于php - 动态特色图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20020916/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com