WordPress.org

Support

Support » Plugins and Hacks » Hacks » Adding custom value next to header

Adding custom value next to header

  • Hi,

    I’ve searched and searched for days, but I’ve found no answer.

    I have a custom field called “Image” (which is linked to an image) that I want displayed next to my post’s title in the single page and on the main page. However, I’ve no idea how to recall the custom filed or where to display the code that does it.

    I believe <?php $image = get_post_meta($post->ID, 'Image', true); ?> should get the image, but I’ve no idea where to put the code or how to get it to display.

    Any help would be greatly appreciated.

    FYI. I’m using a child theme and I’m using Twenty Eleven.

    Thanks
    `

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    @bcworkz

    Hook the filter “the_content”. Your function will be passed the entire html for a post. Search for the spot to insert your image and insert the complete "<img src='" . $image . "'>" tag there. Return the updated content and it will all be displayed during the loop.

Viewing 1 replies (of 1 total)
  • The topic ‘Adding custom value next to header’ is closed to new replies.
Skip to toolbar