Medium size image by plugin called dynamic featured image

后端 未结 1 474
忘掉有多难
忘掉有多难 2021-01-16 05:41

i am using dynamic featured image and adding multiple product images to a single custom post type name as products for a single product but and i am trying to get those imag

相关标签:
1条回答
  • 2021-01-16 06:16

    You need to get medium sized image by calling get_image_url function. Try this:

    <?php     
        if( class_exists('Dynamic_Featured_Image') ) {
        global $dynamic_featured_image;
    
        $featured_images = $dynamic_featured_image->get_featured_images();
    
        foreach($featured_images as $featured_image) {
                $mediumSizedImage = $dynamic_featured_image->get_image_url($featured_image['attachment_id'], 'medium');       
                   echo "<img src = '" . $mediumSizedImage . "' />";
            ?>
            <a href="<?php echo $featured_image['full'];?>" rel="rings" rev="<?php echo $mediumSizedImage ?>"><img width="60" src="<?php echo $featured_image['full'];?>"/></a>
        <?php }
    
        }
    ?>
    

    All available functions are documented here.

    PS: I am author of the plugin.

    0 讨论(0)
提交回复
热议问题