WordPress カスタムフィールドの表示方法

WordPressのカスタムフィールドの表示タグは以下の通り。


<?php
$field = get_post_meta($post--->ID, 'カスタムフィールドの名前', true);
if($field != '') {
echo get_post_meta($post->ID, 'カスタムフィールドの名前', true);
} else {
echo '値が空欄の表示文言';
}
?>

Copyright © All Rights Reserved · Green Hope Theme by Sivan & schiy · Proudly powered by WordPress