テーマファイルのimagesディレクトリに任意の画像をアップロードして、以下のコードを書く。
ソースコード
1 2 3 4 5 | <?php if (has_post_thumbnail()) : ?> <?php the_post_thumbnail(); ?> <?php else: ?> <img alt=”” src=”<?php echo get_template_directory_uri(); ?>/images/ファイル名” /> <?php endif; ?> |
テーマファイルのimagesディレクトリに任意の画像をアップロードして、以下のコードを書く。
1 2 3 4 5 | <?php if (has_post_thumbnail()) : ?> <?php the_post_thumbnail(); ?> <?php else: ?> <img alt=”” src=”<?php echo get_template_directory_uri(); ?>/images/ファイル名” /> <?php endif; ?> |