-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar.php
173 lines (122 loc) · 3.78 KB
/
sidebar.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<div id="sidebar">
<?php
// If we are showing a Bio Diversity Page, then let's show all the Classifications
if ( 'biodiversity' == get_post_type() ) {
get_template_part('sidebar-biodiversity');
}
// Else if Biology Post type or page
elseif ( 'biology' == get_post_type() || is_page('world-biology') ) {
get_template_part('sidebar-biology');
} // Else if Biology
// Else if Filmmaking or film page
elseif ( 'filmmaking' == get_post_type() || is_page('how-to-filmmaking') ) { // if viewing a Biology Taxonomy
get_template_part('sidebar-filmmaking');
} ?>
<div class="sideitem orange">
<h3>Untamed Science Updates</h3>
<?php get_template_part( 'includes/newsletter' ); ?>
</div><!-- sideitem -->
<?php
// $post = get_post(86);
// setup_postdata( $post );
// $googleScript = get_field('body_script');
// $enable = get_field('enable_ad');
// if( $enable == 'Yes' ) :
// echo '<!-- right big -->';
// echo '<div class="ad">';
// if( $googleScript != '' ) {
// echo $googleScript;
// }
// echo '</div><!-- ad -->';
// endif;
// wp_reset_postdata();
?>
<!-- <div class="sidebox-video-list">
<a href="<?php bloginfo('url'); ?>/science-videos-list/">View Science Vidoes</a>
</div>
<div class="sidebox-study-biology">
<a href="<?php bloginfo('url'); ?>/world-biology/">Studying Biology?</a>
</div> -->
<?php if( have_rows('sideboxes', 'option') ): while( have_rows('sideboxes', 'option') ): the_row();
$boxtitle = get_sub_field('title', 'option');
$color = get_sub_field('color', 'option');
$link = get_sub_field('link', 'option');
$image = get_sub_field('image', 'option');
$url = $image['url'];
$title = $image['title'];
$alt = $image['alt'];
$caption = $image['caption'];
$size = 'medium';
$thumb = $image['sizes'][ $size ];
$width = $image['sizes'][ $size . '-width' ];
$height = $image['sizes'][ $size . '-height' ];
?>
<div class="sideitem <?php echo $color ?>">
<a href="<?php echo $link; ?>">
<h3><?php echo $boxtitle; ?></h3>
<img src="<?php echo $thumb; ?>" alt="<?php echo $alt; ?>" title="<?php echo $title; ?>" />
</a>
</div><!-- sideitem -->
<?php endwhile; endif; ?>
<div class="clear"></div>
<?php
/*
Ad # 1
_______________________________________*/
$post = get_post(2501);
setup_postdata( $post );
$googleScript = get_field('body_script');
$enable = get_field('enable_ad');
if( $enable == 'Yes' ) :
echo '<!-- AD #1 -->';
echo '<div class="ad">';
if( $googleScript != '' ) {
echo $googleScript;
}
echo '</div><!-- ad -->';
endif; // endif the ad is enabled
wp_reset_postdata();
/*
Ad # 2
_______________________________________*/
$post = get_post(2502);
setup_postdata( $post );
$googleScript = get_field('body_script');
$enable = get_field('enable_ad');
if( $enable == 'Yes' ) :
echo '<!-- AD #2 -->';
echo '<div class="ad">';
if( $googleScript != '' ) {
echo $googleScript;
}
echo '</div><!-- ad -->';
endif; // endif the ad is enabled
wp_reset_postdata();
/*
Ad # 3
_______________________________________*/
$post = get_post(2503);
setup_postdata( $post );
$googleScript = get_field('body_script');
$enable = get_field('enable_ad');
if( $enable == 'Yes' ) :
echo '<!-- AD #3 -->';
echo '<div class="ad">';
if( $googleScript != '' ) {
echo $googleScript;
}
echo '</div><!-- ad -->';
endif; // endif the ad is enabled
wp_reset_postdata();
?>
<?php // If a Side Box is Defined....
if(get_field('sideboxes')): ?>
<?php while(has_sub_field('sideboxes')): ?>
<div class="sideitem <?php the_sub_field('color'); ?>">
<h3><?php the_sub_field('title'); ?></h3>
<?php the_sub_field('contents'); ?>
</div><!-- side item -->
<?php endwhile; ?>
<?php endif;// if a sidebox is defined ?>
</div><!-- sidebar -->
<?php wp_reset_postdata(); wp_reset_query(); ?>