WordPress.org

Support

Support » Plugins and Hacks » Dynamic Featured Image » [Resolved] Multiple Featured Images Not Showing in Homepage Slider

[Resolved] Multiple Featured Images Not Showing in Homepage Slider

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Ankit

    @ankitpokhrel

    Hello laurenfae,

    Yes, it is possible! You need to fetch the featured image and display it in your page manually.

    Example Code:

    if( class_exists('Dynamic_Featured_Image') ) {
         global $dynamic_featured_image;
         $featuredImages = $dynamic_featured_image->get_featured_images( $postId );
    
       //Loop through the image to display your image
    
       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

    Hello Ankit,

    Thanks for the response and the code! So do I paste this into the theme’s code? Or will this go into the code for each post? I’m trying to use multiple featured images for each post I create. I’m sure you get this often… I’m not terribly proficient with HTML and CSS. Thank you!

    Hey again,

    So I figured out that I have to paste the code into the functions.php file… Am I correct? Although when I pasted it, the code just showed up at the top of my website’s homepage so I’m still doing something wrong. I may need the idiot’s guide to HTML… haha. Thanks again for your help.

    Plugin Author Ankit

    @ankitpokhrel

    Hello Leurenfae,

    functions.php file is not a good place to add that script. Place it at the place where you want the images to be displayed. For example, if you want to display it in a page you should add it somewhere in page.php but it depends on how the the theme you are using is created.

    Thanks,
    Ankit

    Ankit,

    Thanks for the nice plugin.

    I tried your example code above. I notice that it doesn’t retrieve the 1st feature image (wordpress default).

    It successfully retrieve 2nd feature image onwards.

    Any idea?

    Thanks.

    Plugin Author Ankit

    @ankitpokhrel

    Hello @kbengmy,

    Glad to know that you like the plugin. The function for that will be included in the next release.

    Regards,
    Ankit

    Ankit,

    Thanks for the replied.

    I thought I did something wrong.

    I use it for portfolio display images.

    Thanks again for the nice plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Multiple Featured Images Not Showing in Homepage Slider’ is closed to new replies.
Skip to toolbar