Specify Image in Page Edit Screen (2 posts)

  1. oddible
    Posted 5 years ago #

    I would like to specify an image in the page edit screen. I've seen a lot of posts on how to associate a specific image to a page by digging in the template but I can't have users editing php. What I'm looking for is when a user creates a new page, they get a prompt for an image to associate with that page. I'll then cobble together the template to show that image. Simple would be if the user just could post a URL that got saved with the page so I could grab it in the template. More complex would be uploading an image to attach to the page.

    Anyone point me to any resources to do this (or direct me to an elusive plugin that does exactly what I want)?

    Thanks in advance.

  2. oddible
    Posted 5 years ago #

    Well, not sure if this is elegant but it is working. I am using a custom field called 'tripimg' and adding the URL to an image. I then created a new page template and added the following:

    if ((get_post_meta($post->ID, "tripimg", true) !== "")){
    $my_custom_field = get_post_meta($post->ID, "tripimg", true);
    echo "<div id='tripimgheader'><img class='tripimg' src='".$my_custom_field."' /></div>";

Topic Closed

This topic has been closed to new replies.

About this Topic