WordPress.org

Support

Support » Plugins and Hacks » Dynamic Featured Image » [Resolved] Please explain version 3.0

[Resolved] Please explain version 3.0

  • Since upgrading to version 3, dynamic featured image no longer works on my theme. I have updated the retrieval code to:

    if( class_exists(‘Dynamic_Featured_Image’) ) {
    global $dynamic_featured_image;
    $featured_images = $dynamic_featured_image->get_featured_images( $postId );

    //You can now loop through the image to display them as required
    }

    BUT there are no instructions as to how to call this data as an image. Please can you give an example of how you can call a linked image within a theme…

    https://wordpress.org/plugins/dynamic-featured-image/

Viewing 1 replies (of 1 total)
  • Plugin Author Ankit Pokhrel

    @ankitpokhrel

    Hello Jenna,

    The process for calling the data as an image is same as before. Try this:

    if( class_exists('Dynamic_Featured_Image') ) {
      global $dynamic_featured_image;
      $featuredImages = $dynamic_featured_image->get_featured_images( $postId );
    
      //You can now loop through the image to display them as required
      if( !is_null($featuredImages) ){
    
            $links = array();
    
            foreach($featuredImages as $images){
                $thumb = $images['thumb'];
                $fullImage = $images['full'];
    
                $links[] = "<a href='{$fullImage}' class='dfiImageLink'><img src='{$thumb}' alt='' height='{$height}' width='{$width}' /></a>";
            }
    
            echo "<div class='dfiImages'>";
            foreach($links as $link){
              echo $link;
            }
            echo "<div style='clear:both'></div>";
            echo "</div>";
         }
    }

    Thanks,
    Ankit

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Please explain version 3.0’ is closed to new replies.
Skip to toolbar