Advanced custom fields plugin.

Display ACF select field

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
// vars
$colors = get_field('test_select');
  
// check
if( $colors && in_array('select1', $colors) ): ?>
<p>SELECT 1</p>
<?php elseif( $colors && in_array('select2', $colors) ): ?>
<p>SELECT 2</p>
<?php elseif( $colors && in_array('select3', $colors) ): ?>
<p>SELECT 3</p>
<?php elseif( $colors && in_array('select4', $colors) ): ?>
<p>SELECT 4</p>
<?php else: ?>
 <p> NOTHING SELECTED</p>
<?php endif; ?>

Contact me.

I would love to hear from you, send me a message using the form below.

    ×