动态特色图像

Wez*_*zou 3 php arrays wordpress wordpress-featured-image

我最近为 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;
?>
Run Code Online (Sandbox Code Playgroud)

并用它来链接图像。

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

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

bli*_*n12 5

我不是 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;
Run Code Online (Sandbox Code Playgroud)

这对我来说有效。我使用的是 DFI 3.1.13