• Resolved themerdreamer

    (@themerdreamer)


    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 https://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

Viewing 2 replies - 1 through 2 (of 2 total)
  • t31os

    (@t31os)

    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..

    Thread Starter themerdreamer

    (@themerdreamer)

    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 – ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom field doesn’t show’ is closed to new replies.