• Resolved valentinarachiele

    (@cocciolina)


    Hello and thank you for the excellent plugin. I’m using a custom template to show a list of downloads and I added this line of code

    <?php $dlm_download->the_image(); ?>

    to display the featured image for each download (and obviously my downloads have a featured image), but it’s showing a placeholder image.

    I tried to use this lines of code instead

    <?php if ( has_post_thumbnail() ) : ?>
    
    		<?php the_post_thumbnail(); ?>
    
    <?php endif; ?>

    but it’s not working.

    Help?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Razvan Aldea

    (@raldea89)

    Hello @cocciolina ,

    The <?php $dlm_download->the_image(); ?> should have worked, just tested again on my end and works fine.

    Could you please send a screenshot of the template you created? Or complete code, so we can check.

    Warmly,
    Razvan

    Thread Starter valentinarachiele

    (@cocciolina)

    Hello and thank you for your answer.

    My complete template code is:

    <?php
    /**
     * Default output for a download via the [download] shortcode
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    } // Exit if accessed directly
    
    if ( ! isset( $dlm_download ) || ! $dlm_download ) {
    	return esc_html__( 'No download found', 'download-monitor' );
    }
    
    /** @var DLM_Download $dlm_download */
    /** @var Attributes $dlm_attributes */
    ?>
    
    <?php $dlm_download->the_image(); ?>
    <a class="download-link<?php echo ( ! empty( $dlm_attributes['className'] ) ) ? ' ' . esc_attr( $dlm_attributes['className'] ) : '' ; ?>" title="" href="<?php esc_url( $dlm_download->the_download_link() ); ?>" rel="nofollow">
    	
    	<?php $dlm_download->the_title(); ?> | <?php echo date("d-m-Y",$dlm_download->get_version()->get_date()->format( 'U' )); ?>
    </a>
    <p><?php $dlm_download->the_excerpt(); ?></p>
    

    Everything works, except for the “<?php $dlm_download->the_image(); ?>” line.

    Thread Starter valentinarachiele

    (@cocciolina)

    Hello there,

    I just wanted to know if you have some news on this?

    Thank you!

    Plugin Author Razvan Aldea

    (@raldea89)

    Hello @cocciolina ,

    Sorry for the late reply. I’ve put your code into a template and it seems to work, the thumbnail is there and displayed. Can you check if it’s not hidden by some CSS or removed by JS on your website?

    Warmly,
    Razvan

    Thread Starter valentinarachiele

    (@cocciolina)

    Hello Razvan,

    thank you for your support. After updating the plugin, the featured images are working!

    Thank you,

    V

    Plugin Author Razvan Aldea

    (@raldea89)

    Very glad the problem has been resolved ??

    Have a wonderful day!
    Razvan

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Featured image not showing’ is closed to new replies.