Title: Custom post meta line
Last modified: August 19, 2016

---

# Custom post meta line

 *  [iwscm](https://wordpress.org/support/users/iwscm/)
 * (@iwscm)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/custom-post-meta-line/)
 * I want to add a custom post meta line under each of my post titles to replace
   the theme post meta. It will say:
 * By ‘author’ on ‘date’ from ‘location’
 * Here’s the code I have so far:
 *     ```
       function add_custom_meta () {
       $customField = get_post_custom_values("location");
       $postauthor = the_author();
       $postdate = the_time('l, F jS, Y');
   
          if (isset($customField[0])) {
           echo "By ".$postauthor."on ".$postdate."from ".$customField[0];
       	}
       	else
       	{
           echo "By ".$postauthor."on ".$postdate;
           }
       }
       add_action('headway_below_post_title', 'add_custom_meta', 1);
       ```
   
 * Here’s what that code produces. I tried playing with it, but I didn’t make any
   progress. Can you spot what’s wrong?:
 * **Hello world!**
    adminThursday, October 21st, 2010By admin on from Paris, France
 * **Hello World with no location**
    adminThursday, October 21st, 2010By admin on

The topic ‘Custom post meta line’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [iwscm](https://wordpress.org/support/users/iwscm/)
 * Last activity: [15 years, 6 months ago](https://wordpress.org/support/topic/custom-post-meta-line/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
