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, FranceHello World with no location
adminThursday, October 21st, 2010By admin on
The topic ‘Custom post meta line’ is closed to new replies.