• Resolved audig11290

    (@audig11290)


    Hi, I’m using partials to provide greater control over the output of Display-Posts, but none of the listings’ featured image are shown. Here is my code, based on ‘dps-small.php’. I think the problem is centred around my use of wp_get_attachment_image and the echo statement.

    echo '<a class="image" href="' . get_permalink() . '">' . wp_get_attachment_image( $attachment_id, $original_atts['image_size'] ) . '</a>';

    The line is constructed, with the permalink, it is just the image part that is omitted. Thanks.

Viewing 1 replies (of 1 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    Are you defining $attachment_id anywhere? That’s probably your issue.

    Change $attachment_id to get_post_thumbnail_id(). Ex:

    echo '<a class="image" href="' . get_permalink() . '">' . wp_get_attachment_image( get_post_thumbnail_id(), $original_atts['image_size'] ) . '</a>';

Viewing 1 replies (of 1 total)
  • The topic ‘Using partials to display featured image’ is closed to new replies.