• I am trying to display a custom field that is an image upload. customfield_display=”preview-image”

    This code returns the media ID in the display: “preview-image : 887”

    Is there a way to return the image? Could I wrap the template code in something to return the image from the field?

    //Custom fields:
    $lcp_display_output .= $this->get_custom_fields($single);

    https://www.ads-software.com/plugins/list-category-posts/

Viewing 1 replies (of 1 total)
  • Thread Starter srhom

    (@srhom)

    I ended up with this code. It works to display the image, but please let me know if there’s a more elegant way to do this.

    //Custom fields:
      //$lcp_display_output .= $this->get_custom_fields($single);
    
      $image_lcp = $this->get_custom_fields($single);
    
      $image_id = strip_tags($image_lcp);
    
      $preview_image = wp_get_attachment_image( $image_id , 'full' );
    
      $lcp_display_output .= $preview_image;
Viewing 1 replies (of 1 total)
  • The topic ‘Display image custom field’ is closed to new replies.