WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Featured Image
[resolved] To get featured images in a post loop? (16 posts)

  1. fuzwpress
    Member
    Posted 4 months ago #

    Step 1 Done/
    Step 2 Done/
    Step 3 Done/
    Step 4 Done/... But...!!
    This is where I need help, I tried calling the function from every file on my theme's dir and nothing... :(
    I tried this snippet:
    <?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;
    ?>

    I tried this other one:
    <?php
    if( function_exists('dfi_get_featured_images') ){
    $featuredImages = dfi_get_featured_images();

    //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[] = "<img src='{$thumb}' alt='' height='{$height}' width='{$width}' />";
    }

    echo "<div class='dfiImages'>";
    foreach($links as $link){
    echo $link;
    }
    echo "<div style='clear:both'></div>";
    echo "</div>";
    }

    }
    ?>

    And no show...

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

  2. Ankit Pokhrel
    Member
    Plugin Author

    Posted 4 months ago #

    Hi,

    Thank you for using the plugin. Can you provide more details?

    Thanks,
    Ankit

  3. fuzwpress
    Member
    Posted 4 months ago #

    Thanks for your reply,

    I am working with a theme that has a portfolio section where each post has a featured image and a gallery. This featured image gets picked up by a lightbox and displayed in a slideshow.

    The problem is that they need to have the slideshow display the same amount of images the post has (3 images) without having to clink on the post to see the post's gallery.

    So since most of the portfolio plugins that I've found have the same functionality where the image comes from the featured set instead of the actual images you add on your post's gallery, I searched and found this solution to add more images to my featured set.

    I installed the plugin and is working normal in admin, I selected 2 featured images in addition to the wp default and updated the post, still looks normal.

    Check the site on a separate tab, navigated to the post but my lightbox does not pick up my other 2 images. I still have to click on the portfolio to see the images instead of browsing through the lightbox slider.

  4. Ankit Pokhrel
    Member
    Plugin Author

    Posted 4 months ago #

    The lightbox will not automatically pick up your image. You need to apply your own logic to display the image in lightbox. The use of the plugin is to allow the user to set images in admin and get those image in the theme. Now its up to you on how to use the received image.

  5. fuzwpress
    Member
    Posted 4 months ago #

    Got it. That's where I need some help, I am trying to pick those images using the plugin's calling function: dfi_get_featured_images([$postId (optional)]) , which I have tried on the single.php, single-folio.php file on the theme I'm working on.

    That didn't work so I tried on all the other relevant theme files which didn't work either.

    I may not be identifying the right file or the right place to put the code in but the only result I've gotten so far is the admin side to work perfectly.

  6. Ankit Pokhrel
    Member
    Plugin Author

    Posted 4 months ago #

    Hi Fuzwpress,

    I can't help you without viewing your code. So pick up the right file and send me the code using pastebin or some similar system. I will check to see what you missed.

    Thanks,
    Ankit

  7. fuzwpress
    Member
    Posted 4 months ago #

    Thanks again for your help Ankit,

    Here is the single.php file from the theme I'm using.

    This theme has another file with the name: single-folio.php, which I had tried to paste the code in that file also with no results...

  8. Ankit Pokhrel
    Member
    Plugin Author

    Posted 4 months ago #

    Thank you for your code. Can you tell me what are you trying to achieve? And can you setup a demo site where i can work on the changes?

  9. fuzwpress
    Member
    Posted 4 months ago #

    I am trying to pick up the extra 2 featured images on the lightbox. As of now, only one image is pulled and that is from the wp default featured img.
    I am working on a sub-folder, I can email you the login details if you need them.

    If you click on the image, the lightbox picks only the "featured" image., but I need to pick up the added featured images that Dynamic Featured Image 'awesome' plugin added to the post.

    Obviously, if you click on the post, then this happens automatically but then what is the need for a lightbox.

  10. Ankit Pokhrel
    Member
    Plugin Author

    Posted 4 months ago #

    If you do var_dump( $featuredImages ) after this statement $featuredImages = dfi_get_featured_images(); does it show returned data (array)?

  11. fuzwpress
    Member
    Posted 4 months ago #

    no luck...
    I have been playing around with single.php (you can see what I have) but nothing's happening.

    How can I verify if the images are there? they do show up on my admin sidebar though..

  12. Ankit Pokhrel
    Member
    Plugin Author

    Posted 4 months ago #

    Hi,

    I found that there was some syntax error in your script. Try this paste and let me know what's the result of var_dump.

    Thanks,
    Ankit

  13. fuzwpress
    Member
    Posted 4 months ago #

    Hello,

    No Luck.. :(..
    Need a break on this issue...

    happy holidays btw.

    Thank you for your help.
    fuz

  14. laurenfae
    Member
    Posted 1 month ago #

    Hi there,

    I am having a similar issue, however I'm seeing that this one wasn't fully resolved either. I am using the Slider Responsive theme from Dessign.net, so my homepage features a slideshow that uses the "featured images" from my posts. I installed your plugin and was able to choose the additional featured images, however they are not showing up in the slideshow. Only the first images for each post are. My website is http://www.laurenmclaughlin.com. Any help is most appreciated! Thank you!

  15. sayanisscs
    Member
    Posted 4 weeks ago #

    Same problem with me;tried this code hundred times with my theme but nothing shows up

    Have worked with this plugin in wordpress older version it worked like champ..but with 3.8.1 there must be some issues.

  16. sayanisscs
    Member
    Posted 4 weeks ago #

    <?php
    /**
    * The Template for displaying all single posts.
    */
    ?>
    <?php get_header();?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    <div id="bodyBlock">
    <div class="aboutContent">
    <div class="gallertTitleHolder">
    <div class="titleGal"><?php the_title();?></div>
    <div class="titleForm">GET A FREE SAME DAY QUOTE</div>
    <div class="spacer"></div>
    </div>
    <div class="gallert_sport">
    <div id="beast_gal_scroll">
    <div class="ad-gallery">
    <div class="ad-image-wrapper"><div class="ad-image"><img width="517" height="308" src="<?php echo get_template_directory_uri(); ?>/images/galleries/afl/beastwearpagesafl.png"></div><img src="http://demo7.prospectsoftech.com/images/loader.gif" class="ad-loader"></div>
    <div class="ad-controls">
    <p class="ad-info">31 / 34</p><div class="ad-next"><div class="ad-next-image"></div></div><div class="ad-prev"><div class="ad-prev-image"></div></div><div class="ad-slideshow-controls ad-slideshow-running"><span class="ad-slideshow-start">Start</span><span class="ad-slideshow-stop">Stop</span><span class="ad-slideshow-countdown">(5)</span></div><p class="ad-info">2 / 4</p><div class="ad-next"><div class="ad-next-image"></div></div><div class="ad-prev"><div class="ad-prev-image"></div></div><div class="ad-slideshow-controls"><span class="ad-slideshow-start">Start</span><span class="ad-slideshow-stop">Stop</span><span class="ad-slideshow-countdown">(5)</span></div></div>

    <div class="bottom_gray_box">
    <div class="ad-nav"><div class="ad-back"></div><!--<div class="ad-back"></div>-->
    <div class="ad-thumbs">

    <div align="center">
    <ul class="ad-thumb-list">
    <?php
    //while ( have_posts() ) : the_post();

    if( function_exists('dfi_get_featured_images') ) {
    $featuredImages = dfi_get_featured_images();

    //Loop through the image to display your image

    if( !is_null($featuredImages) ){

    $links = array();

    foreach($featuredImages as $images){
    $thumb = $images['thumb'];
    $fullImage = $images['full'];

    echo "

  17. ";
    echo $links[] = "<img width='70' height='40' src='{$thumb}' style='opacity: 0.7;'>";
    echo "
  18. ";
    }

    }
    }

    //endwhile;
    ?>

    </div>

    </div>
    <!--<div class="ad-forward"></div>--><div class="ad-forward"></div></div>
    </div>
    </div>
    </div>
    </div>
    <div class="form_sport">
    <!-- content block -->
    <div id="content_1" class="content">
    <?php echo do_shortcode('[contact-form-7 id="365" title="Gallery Contact Form"]');?>
    </div>
    <div class="spacer"></div>
    </div>
    <div class="spacer"></div>
    </div>
    </div>
    <?php endwhile; endif; ?>
    <?php get_footer();?>
    /******************************************/

    Here is the single.php

Reply

You must log in to post.

About this Plugin

About this Topic

Tags