Answers for "custom fields wordpress how to display"

PHP
2

wp display custom fields

<?php
// assign variables for each custom field
$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 is not empty, echo html
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>';
}
?>
Posted by: Guest on October-27-2020
0

How to display custom field in wordpress?

echo get_post_meta($post->ID, 'keyName', true);
Posted by: Guest on May-13-2021

Code answers related to "custom fields wordpress how to display"

Browse Popular Code Answers by Language