1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Wordpressの管理画面で簡単に条件分岐

Last updated at Posted at 2021-12-22

Wordpressの管理画面で簡単に条件分岐をする方法をまとめます。
使用したプラグインは「Advanced Custom Fields」

Advanced Custom Fields

https://ja.wordpress.org/plugins/advanced-custom-fields/

Advanced Custom Fieldsの設定

条件判定を「はい」にして、表示する条件を設定します。![資料1.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2322744/cfadb8b4-9350-4c5a-c5a6-aad12eb048cd.jpeg)

管理画面、投稿ページの見た目

ラジオボタンの選択内容によって、入力欄が変動するようになります。 2パターンを選んだ場合は入力欄が増えます。

1パターン

![資料2.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2322744/f5a81ff2-a557-a10c-80b3-cc8d9fad8b0e.jpeg)

2パターン

![資料3.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/2322744/be592737-14aa-2313-10dc-f47d352d9330.jpeg)

テーマ側の出力例

``` ID, '時間1', true)): ?> ID,'曜日1'); $checkmeta = $checkmeta[0]; if($check) { foreach($checkmeta as $v) { echo '' . $check['choices'][$v] .''; } } ?>

ID, '時間2', true)): ?> ID,'曜日2'); $checkmeta = $checkmeta[0]; if($check) { foreach($checkmeta as $v) { echo '' . $check['choices'][$v] .''; } } ?>

```
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?