Print Custom Field Value Using Post ID
Description
This code will print the custom field value for a specific post using the ID of the post. In this case the post is number “243” so just change this number to the post of your choice and also change the custom field name to match the field name inside that post
This code will print the custom field value for a specific post using the ID of the post. In this case the post is number “243” so just change this number to the post of your choice and also change the custom field name to match the field name inside that post
PHP Source Code
<?php $my_id = 243; echo get_post_meta($my_id, 'CustomFieldName', true); ?>
<a href="<?php $my_id = 243; echo get_post_meta($my_id, 'CustomFieldName', true); ?>" target="_blank"> Custom Field Name</a>