Forums

I need some quick custom fields help. (7 posts)

  1. spartana
    Member
    Posted 2 years ago #

    I'm working on a news portal-esque site and have assigned a custom field to each article ('byline') with the writer's name. How do I call this custom field in my singlepost.php and index.php within my template? I've tried a few suggestions for code, but none have worked. Thanks in advance for helping out a noob.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

  3. spartana
    Member
    Posted 2 years ago #

    I have already read that inside and out, bro. Check my site. For example, under the title "Hockey team delivered wake-up call," I would like it to read "Posted on 2009-12-22 by CUSTOM FIELD VALUE." How do I call that value with code?

  4. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    What's the name of the key for that custom field?

  5. spartana
    Member
    Posted 2 years ago #

    byline

  6. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Try `Posted on <?php the_date('Y-m-d'); ?>
    by <?php echo get_post_meta( $post->ID, 'byline', true );?>`

  7. spartana
    Member
    Posted 2 years ago #

    It works. Thanks. I was omitting the "echo."

Topic Closed

This topic has been closed to new replies.

About this Topic