Forums

[resolved] Custom field doesn't show (3 posts)

  1. themerdreamer
    Member
    Posted 3 years ago #

    I created and saved a custom field Key: Author Value: Joe Public

    then I added following code to header.php:

    <?php echo get_post_meta($post->ID, 'Author', TRUE); ?>

    (as per instructions at http://www.bloggingtips.com/2008/11/02/wordpress-custom-fields/)

    However, nothing shows.

    Got the feeling I should be adding this code to another template (and if so which one and where in the template?)

    Hope someone can help me out

    thanks

  2. t31os
    Member
    Posted 3 years ago #

    It needs to be inside the loop in order to use the post ID, which more then likely will not be in the header.

    index.php
    category.php
    archive.php
    single.php

    Depending on when you want it shown... and what template files you have..

  3. themerdreamer
    Member
    Posted 3 years ago #

    Thanks for your help - I actually used this code: <?php the_meta(); ?> in Loop of index.php - now I'm going to try that out in other template pages as per your list above - :)

Topic Closed

This topic has been closed to new replies.

About this Topic