Dynamic_Featured_Image,主题添加了图像裁剪

时间:2014-08-22 08:04:56

标签: wordpress wordpress-plugin dynamic-featured-image

我正在使用插件" Dynamic_Featured_Image"对于wordpress。我可以让图像显示所有默认图像大小(全/中/拇指),但我希望它在我的主题中使用自定义添加的图像。

<?php
    if( class_exists('Dynamic_Featured_Image') )
    {
        global $dynamic_featured_image;
        $featured_images = $dynamic_featured_image->get_featured_images();

        $i = 0;
        foreach ($featured_images as $row=>$innerArray)
        {
            $id = $featured_images[$i]['attachment_id'];

            $mediumSizedImage = $dynamic_featured_image->get_image_url($id,'conferance'); 
            $caption = $dynamic_featured_image->get_image_caption( $mediumSizedImage );

            echo "      <li><img src=\"".$mediumSizedImage."\" alt=\"".$caption."\"><div class=\"captionText\">".$caption."&nbsp;</div></li>";

            $i++;
        }
    }
?>

主题支持的拇指是:

add_theme_support( 'post-thumbnails' );
add_image_size( 'conferance', 570, 335, true );

但是当我获取图像时,它仍然是完整的(原始大小)。任何线索为什么?

1 个答案:

答案 0 :(得分:0)

您的代码按预期工作。您似乎在上传图片后添加了新图片尺寸conferance。 WordPress不会重新生成新注册的大小,它只会将其应用于将来的上传。请参阅此thread