PDF Cover Image

PHOTO EMBED

Tue Dec 27 2022 06:17:08 GMT+0000 (Coordinated Universal Time)

Saved by @omnixima #php

$thumbnail = get_the_post_thumbnail( $the_id, $image_size );
if ( $thumbnail == '' ) {
  $press_pdf = get_field( 'press_releases_pdf', $the_id );
  if ( $press_pdf ) {
    $file_url = $press_pdf['url'];
    $pdf_image = str_replace('.pdf', '-pdf.jpg', $file_url);
  }
  $thumbnail = '<img class="pdf-image-thumbnail" src="'.$pdf_image.'">';
}
content_copyCOPY