Title: A helping hand.
Last modified: August 20, 2016

---

# A helping hand.

 *  Resolved [mogito](https://wordpress.org/support/users/mogito/)
 * (@mogito)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/a-helping-hand/)
 * Hello, could some kind soul point me in the right direction by any chance….?
 * I have this code added to my functions file. This is to ADD a custom field to
   the content but it doesn’t seem to work 🙁 . Can anyone see anything wrong with
   this code?
 *     ```
       function added_content($content) {
          $customimage = get_post_meta($post->ID, 'Images', true);
          $content = $content . $customimage ;
          return $content;
       }
       add_filter( 'the_content', 'added_content' );
       ```
   
 * Thanks for your help!

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/a-helping-hand/#post-2273400)
 * Yes – where is $post->ID supposed to be coming from?
 *  Thread Starter [mogito](https://wordpress.org/support/users/mogito/)
 * (@mogito)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/a-helping-hand/#post-2273406)
 * Hi Esmi.
 * Hrmmmmm………well….the short answer is, i don’t know.
 * Appologies for the ignorance but I took the get_post_meta() function from my 
   theme template – where it works fine, BUT ….now im realising that’s because it
   was within the loop. Woops.
 * …..How would i get this to work as if it were inside the loop?
 * HUGE newbie to php – struggling through….
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/a-helping-hand/#post-2273410)
 * Try:
 *     ```
       function added_content($content) {
          global &post;
          $customimage = get_post_meta($post->ID, 'Images', true);
          $content = $content . $customimage ;
          return $content;
       }
       add_filter( 'the_content', 'added_content' );
       ```
   
 *  Thread Starter [mogito](https://wordpress.org/support/users/mogito/)
 * (@mogito)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/a-helping-hand/#post-2273413)
 * Woo…it works – your a legend!
 * So….i guess i need to remember to call the global post variable.
 * i WILL remember this for next time.
 * Thanks for your time esmi.
 * Struan
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/a-helping-hand/#post-2273417)
 * No problem. 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘A helping hand.’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/a-helping-hand/#post-2273417)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
