プラグイン Advanced Custom Fields を利用する
テキスト: <?php if( get_field('text') ) { ?> <p><?php the_field('text'); ?></p> <?php } ?> テキストエリア: <?php if( get_field('textarea') ) { ?> <p><?php the_field('textarea'); ?></p> <?php } ?> Wysiwyg エディタ: <?php if( get_field('tuijyuu') ) { ?> <?php the_field('tuijyuu'); ?> <?php } ?> 画像(返り値が「画像ID」の場合): <?php if( get_field('image_id') ) { ?> <?php $imgid = get_field('image_id'); $img = wp_get_attachment_image_src( $imgid , 'full' ); ?> <img src="<?php echo $img[0]; ?>" width="<?php echo $img[1]; ?>" height="<?php echo $img[2]; ?>" alt="<?php the_title_attribute(); ?>"> <?php } ?>