Forums

Echo custom field in post (1 post)

  1. trodat
    Member
    Posted 2 years ago #

    I'm trying to echo/print a specific custom field (if there is one assigned to the post) within the filters.php file. "Type of Article" would be the key with 4 different values. For example:

    Type of Article: Checklist

    This code seems to be what I want (not sure if it would still echo the "Type of Article:" text if there was no value):

    $postheader .= sprintf( __('<span class="entry-cat">Type of Article: %s</span>', 'arras'), implode(', ', $post_cats) );

    I just don't know how to change the post_cats which echos the category of the article to print the custom field. This code works in the template.php file:

    <?php echo get_post_meta($post->ID, 'article_type', true); ?>

    Can anyone tell me how to get the article_type to work in the first line of code? I'm not php compatible at all... Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic