カスタムフィールド Value Label. Function create_post_type () { //投稿時に使用できる投稿用のパーツを指定 $supports = array (. // カスタムフィールドの値がある場合 if( $value ){ echo $value;
例では、現在の投稿にカスタムフィールドのキー「sample_field」の値があれば、その値を取得し出力します。 <?php // カスタムフィールドの値を取得 $value = get_post_meta( get_the_id(), 'sample_field', true ); カスタムフィールドの検索 (2017.10.16作成) acf 関連をランダム表示に (2017.08.14作成) acf繰り返しフィールドの利用例 (2017.04.15作成) 画像サイズで条件分岐 (2017.02.28作成) acf 繰り返しフィールドの数 (2017.02.06作成) acf relationship (2017.01.11作成) カテゴリーにacf (2016.07. Function create_post_type () { //投稿時に使用できる投稿用のパーツを指定 $supports = array (.
秀逸なプラグイン、Custom Field Gui Utility や Advanced Custom Fields などを使えばかなり便利です。
Function create_post_type () { //投稿時に使用できる投稿用のパーツを指定 $supports = array (. カスタムフィールドの検索 (2017.10.16作成) acf 関連をランダム表示に (2017.08.14作成) acf繰り返しフィールドの利用例 (2017.04.15作成) 画像サイズで条件分岐 (2017.02.28作成) acf 繰り返しフィールドの数 (2017.02.06作成) acf relationship (2017.01.11作成) カテゴリーにacf (2016.07. 例では、現在の投稿にカスタムフィールドのキー「sample_field」の値があれば、その値を取得し出力します。 <?php // カスタムフィールドの値を取得 $value = get_post_meta( get_the_id(), 'sample_field', true );
// カスタムフィールドの値がある場合 If( $Value ){ Echo $Value;
僕は現在は、カスタム投稿タイプを追加するのに、「 types 」、カスタムフィールドを追加するのに、「 custom field suite 」を使用しています。. (labelについてはなくても問題ありません) [id]:カスタムフィールドのid(定義) type:カスタムフィールドの形状(+サイズ) label:投稿画面で表示されるテキスト(注意事項など) また、typeは、様々な種類を設定可能です。
You have just read the article entitled
カスタムフィールド Value Label. You can also bookmark this page with the URL :
https://melinaokung.blogspot.com/2022/04/value-label.html
0 Response to "カスタムフィールド Value Label"
Post a Comment