wordpressのRest APIからデータを取得
kurumin
プログラミングのーと
<?php if(!empty($item)): ?>
処理
<?php endif ?>カスタムフィールドの値を取得
$image = get_field('image');IDからタイトルを出力
echo get_the_title($item)IDからリンクを出力
echo get_the_permalink($item)特定の記事IDのカスタムフィールドの値を取得
get_field('image', $id);現在のページの投稿タイプを取得する
$post_type = get_post_type();現在のぺージのカテゴリーを取得する
$terms = get_the_terms(get_the_ID(), $category);
$term = $terms[0]->name;nameの他にもIDの取得もできる