Leave a Reply

2 comments

  1. I don’t know exactly how that plugin works, and you have posted code that is probably missing context but you need to define $post_meta_data before running line:

    $custom_image = $post_meta_data['image'][0];
    

    It seems that the plugin is using post meta so you should need something like this:

    <?php echo get_post_meta($post->ID, $prefix.'hjemmeside', true); ?>
    

    But rewritten to save the data as a variable instead of echo it. Guessing based on the code you posted, I believe you need:

    $post_meta_data = get_post_meta($post->ID, $prefix.'image', true);
    if (!empty($post_meta_data[0])) {
      $custom_image =  wp_get_attachment_image($post_meta_data[0], 'thumbnail');
    }
    echo $custom_image; // if desired
    

    Untested, but stands a good chance of working.