Title: Displaying Custom Fields Issue
Last modified: August 22, 2016

---

# Displaying Custom Fields Issue

 *  [mherbert](https://wordpress.org/support/users/mherbert/)
 * (@mherbert)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/displaying-custom-fields-issue/)
 * Hi,
 * I’ve created a custom field “memory_name” to display a name (surprise!). When
   I try to display this field in a post template using:
    `<?php echo get_post_meta(
   $post->ID, "memory_name", true); ?>` it works fine and displays properly.
 * However, I’m trying to insert this field into a plugin’s template using:
    `<p
   class="post-date-timeline">'.get_post_meta($post->ID, "memory_name", true).'\'
   s memory from '.get_the_date().'</p>`
 * The plugin is “Timeline Ultimate” and I’ve posted there, but then wondered if
   there was something general I would need to maybe register the custom field in
   the plugin? get_the_date also works perfectly everywhere.
 * Thanks.

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

 *  [Radices](https://wordpress.org/support/users/radices/)
 * (@radices)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/displaying-custom-fields-issue/#post-5576626)
 * I’d try populating a $Var first and then use that $Var in the class name line.
 *  Thread Starter [mherbert](https://wordpress.org/support/users/mherbert/)
 * (@mherbert)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/displaying-custom-fields-issue/#post-5576644)
 * Hi Radices, I’m not having any success with that either. It’s weird.
 * Would you put the $Var in the plugin’s code, or would you add it to a functions.
   php? I guess it’s not really a function and not needed anywhere else, other than
   the plugin.
 *  Thread Starter [mherbert](https://wordpress.org/support/users/mherbert/)
 * (@mherbert)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/displaying-custom-fields-issue/#post-5576646)
 * PS. Should say that I’m no expert, so there is the potential for a stupid mistake!
 *  [Radices](https://wordpress.org/support/users/radices/)
 * (@radices)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/displaying-custom-fields-issue/#post-5576675)
 * I’d put it in the plugin’s template code . Right above where you want to use 
   it.
 *  [Radices](https://wordpress.org/support/users/radices/)
 * (@radices)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/displaying-custom-fields-issue/#post-5576678)
 *     ```
       <?php $mem_name = get_post_meta($post->ID, "memory_name", true); ?>
   
       <p class="post-date-timeline">'.<php? $mem_name ?>.'\'s memory from '.get_the_date().'</p>
       ```
   
 * I’m a hacker myself … just spit balling with you to try and help. Pretty sure
   you need to wrap the get_the_date in php tags as well.
 *  Thread Starter [mherbert](https://wordpress.org/support/users/mherbert/)
 * (@mherbert)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/displaying-custom-fields-issue/#post-5576698)
 * I don’t want to take up any more of your time, although I do really appreciate
   it. I have a feeling it’s something to do with the plugin that is making it fail
   as “standard” wordpress functions (get_the_author, get_the_date) are all working
   fine.
 * What I’m doing… We’re building a community website and we want to build a timeline
   of people’s memories. I don’t want them to have to create an account (I don’t
   think they would bother), but instead there’s a front end form that creates a
   post when submitted. Because I want the contributor’s name to be displayed, rather
   than the author’s, I use a custom field to collect that. All that side works,
   it’s just displaying it in the plugin. As I say, the custom field displays fine
   everywhere except the one place I need it!
 * As a hacker, can you think of a workaround where I can take a name and have it
   display as the post author without registration, or do you think I’m going about
   it the right way?!
 * As I said before, thanks again for looking.
 *  Thread Starter [mherbert](https://wordpress.org/support/users/mherbert/)
 * (@mherbert)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/displaying-custom-fields-issue/#post-5576708)
 * I found a solution [here](http://www.wpbeginner.com/wp-tutorials/how-to-rewrite-guest-author-name-with-custom-fields-in-wordpress/).
 * Does the job perfectly! Once again, thanks for your help though.

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

The topic ‘Displaying Custom Fields Issue’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [mherbert](https://wordpress.org/support/users/mherbert/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/displaying-custom-fields-issue/#post-5576708)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
