wp get custom field code example
Example 1: get custom field
/* put this code in home.php file create in child theme */
<?php
echo get_post_meta($post->ID, 'Name', true);
?>
/* Or use this code */
<?php
$value =get_field('Name');
echo $value;
?>
Example 2: wp display custom fields
<?php
$your_custom_field_name1 = get_post_meta(get_the_ID(), 'your_custom_field_name', true);
$your_custom_field_name2 = get_post_meta(get_the_ID(), 'your_custom_field_name', true);
if (!empty($your_custom_field_name1)) {
echo '<h3>Label: ' . $your_custom_field_name1 . '<h3>';
}
if (!empty($your_custom_field_name2)) {
echo '<p>ISBN: ' . $your_custom_field_name2 . '</p>';
}
?>