Custom Field Template Post Code

Here’s a quick code snippet to show your custom field data within the loop in a post.

If you’re not familiar with Custom Fields in WordPress, they are a very simple, yet powerful feature of WordPress and the possibilities with them are almost endless. You can create simple text areas like the “mood” bit shown below, or go more in-depth and add links, photos, and more.

$postid=$post->ID;
$mood= get_post_meta($postid, 'Mood', true);
echo "I'm feeling ".$mood;

Leave a comment

Your email address will not be published. Required fields are marked *