【WordPress授業十日目】ブロックエディタ、おすすめプラグイン
ブロックエディタ
WordPress:「テキスト」カテゴリブロック確認 | JOBTECH.JP
WordPress:「メディア」カテゴリブロック確認 | JOBTECH.JP
WordPress:「デザイン」カテゴリブロック確認 | JOBTECH.JP
おすすめプラグイン
カスタムフィールド作成
p05:カスタムフィールド作成「Advanced Custom Fields」 | JOBTECH.JP
●変数に代入してそれを入れていくやり方
<?php
// get_field関数
// カスタムフィールドの値を取得できる
// 第1引数:カスタムフィールドの名前
// 戻り値:カスタムフィールドの種類で異なる
$top_service1_img = get_field('top_service1_img');
$top_service1_title = get_field('top_service1_title');
$top_service1_text = get_field('top_service1_text');
$top_service1_slug = get_field('top_service1_slug');
$top_service2_img = get_field('top_service2_img');
$top_service2_title = get_field('top_service2_title');
$top_service2_text = get_field('top_service2_text');
$top_service2_slug = get_field('top_service2_slug');
$top_service3_img = get_field('top_service3_img');
$top_service3_title = get_field('top_service3_title');
$top_service3_text = get_field('top_service3_text');
$top_service3_slug = get_field('top_service3_slug');
?>
---------------------
body内(下をx3)
<li class="Archive__item">
<figure class="Archive__thumbnail">
</figure>
</a>
</li>
●直接書いて、forでループさせるやり方
<?php
$nam_url = "top_service" . $i . "_slug";
$nam_img = "top_service" . $i . "_img";
$nam_title = "top_service" . $i . "_title";
$nam_text = "top_service" . $i . "_text";
?>
<li class="Archive__item">
<figure class="Archive__thumbnail">
</figure>
</a>
</li>