-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadopt-template.php
90 lines (74 loc) · 3.12 KB
/
adopt-template.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/* Template Name: Adopt Template */
get_header();
?>
<div class="container main">
<h2 class="text-center pageTitle"><?php the_title(); ?></h2>
<?php
$policyCon = get_theme_mod('adoption_content_policy_setting');
$policyTitle = get_theme_mod('adoption_content_title_setting');
$btnTitle = get_theme_mod('adoption_button_title_setting');
$btnLink = get_theme_mod('adoption_button_link_setting');
$notice = get_theme_mod('adoption_notice_setting');
if ($policyCon && $policyTitle || $btnTitle && $btnLink || $notice ):
?>
<div class="col w-100 text-center">
<?php if ($notice): ?>
<p><?= $notice ?></p>
<?php endif; ?>
<?php if ($btnTitle && $btnLink): ?>
<a class="btn blue-btn" href="<?= get_theme_mod('adoption_button_link_setting'); ?>"><?= get_theme_mod('adoption_button_title_setting'); ?></a>
<?php endif; ?>
<?php if ($policyCon && $policyTitle): ?>
<button class="btn red-btn " data-toggle="modal" data-target="#policyModal" ><?= $policyTitle ?></button>
<?php endif; ?>
</div>
<?php if ($policyCon && $policyTitle): ?>
<div class="modal" id="policyModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><?= $policyTitle ?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p><?= $policyCon ?></p>
</div>
<div class="modal-footer">
<button type="button" class="btn red-btn" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
<div class="card-columns">
<?php
$args = array (
'post_type' => 'animal'
);
$animalsPost = new WP_Query($args);
if ($animalsPost->have_posts()):
while ($animalsPost->have_posts()): $animalsPost->the_post();
?>
<div class="card w-100" style="width: 18rem;">
<?php
if( has_post_thumbnail()) {
the_post_thumbnail('card-top', ['class'=>'card-img-top img-fluid', 'alt'=> 'Image of animal']);
};
?>
<div class="card-body">
<h5 class="card-title"><?php the_title(); ?></h5>
<p class="card-text"><?= wp_trim_words( get_the_content() , '20' ); ?></p>
<a class="btn blue-btn float-right" href="<?= esc_url(get_permalink()); ?>">Read More</a>
</div>
</div>
<?php
endwhile;
endif;
?>
</div>
</div>
<?php get_footer();?>