-
Notifications
You must be signed in to change notification settings - Fork 28
/
template-acf.php
59 lines (31 loc) · 863 Bytes
/
template-acf.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
if( !class_exists('acf')) {
echo 'Please install advanced custom fields';
die();
}
/* Template Name: ACF Tutorial */
get_header();
// Variables
$name = get_field('your_name');
$description = get_field('description');
$active = get_field('active');
$colour = get_field('select_a_colour');
?>
<?php if($active):?>
<div class="container py-5">
<?php if($name):?>
<h1><?php echo $name;?></h1>
<?php endif;?>
<?php if($description):?>
<?php echo $description;?>
<?php endif;?>
<?php if( is_array($colour) ):?>
<?php if(in_array('red', $colour)):?>
Red is selected
<?php endif;?>
<?php endif;?>
</div>
<?php else:?>
<div class="container">The page is not active</div>
<?php endif;?>
<?php get_footer();?>