forked from UW-ISC/isc-uw-child
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-admin-corner.php
209 lines (175 loc) · 5.92 KB
/
page-admin-corner.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?php
/**
* Unique template for Admin Corner page
*
* @package isc-uw-child
* @author UW-IT AXDD
*/
get_header();
$url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );
$sidebar = get_post_meta( $post->ID, 'sidebar' );
$seasonal = get_post_meta( $post->ID ); ?>
<?php uw_site_title(); ?>
<?php get_template_part( 'menu', 'mobile' ); ?>
<div role="main">
<div class="isc-admin-hero">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2><?php the_title(); ?></h2>
<form method="get" id="searchform" class="searchform" action="<?php echo esc_url( get_site_url() ); ?>">
<div role="search">
<label class="screen-reader-text" for="s">Search the ISC:</label>
<input type="text" value="" name="s" id="s" placeholder="Search the ISC:" autocomplete="off">
<input type="submit" id="searchsubmit" value="Search">
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container uw-body">
<div class="row">
<div class="col-md-12">
<?php get_template_part( 'breadcrumbs' ); ?>
</div>
</div>
<div class="row">
<div class="col-md-8 uw-content isc-content" role='main'>
<div id='main_content' class="uw-body-copy" tabindex="-1">
<div class="row">
<div class="col-md-12" style="margin-bottom: 2em;">
<?php
wp_nav_menu(
array(
'theme_location' => 'admin-corner-links',
'fallback_cb' => false,
)
);
?>
</div>
</div>
<h3 class="isc-admin-header">Admins' News</h3>
<div class="isc-admin-block">
<?php
$args = array(
'tax_query' => array(
array(
'taxonomy' => 'location',
'field' => 'slug',
'terms' => 'admin-corner-news',
),
),
'posts_per_page' => 5,
'post_status' => 'publish',
);
$category_posts = new WP_Query( $args );
if ( $category_posts->have_posts() ) :
while ( $category_posts->have_posts() ) :
$category_posts->the_post();
?>
<h4><a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title() ?></a></h4>
<div class="update-date"><?php echo get_the_date() ?> </div>
<div class='post-content'><?php the_excerpt() ?></div>
<?php
endwhile;
?>
<a class="uw-btn btn-sm" href="<?php echo esc_url( get_site_url() . '/news' );?>">Read older news</a>
<?php
else :
echo '<p>No admin news available.</p>';
endif;
?>
</div>
</div>
</div>
<div class="col-md-4 uw-sidebar isc-sidebar" role="">
<h3 class="isc-admin-header">Upcoming Event</h3>
<div class="contact-widget-inner isc-widget-tan isc-admin-block">
<div class='post-content isc-events'>
<?php
if ( function_exists( 'tribe_get_events' ) ) {
$events = tribe_get_events(
array(
'posts_per_page' => 1,
'post_status' => 'publish',
'start_date' => date( 'Y-m-d' ),
)
);
if ( empty( $events ) ) {
echo 'No events found.';
} else {
$current = $events[0];
$title = $current->post_title;
$html = '<h4><a href="' . get_post_permalink( $current->ID ) . '">' . $title . '</a> </h4>';
$html .= "<div class='event-date'>" . tribe_get_start_date( $current ) . '</div>';
if ( tribe_has_venue( $current->ID ) ) {
$details = tribe_get_venue_details( $current->ID );
$html .= "<div class='event-location'><i class='fa fa-map-marker' aria-hidden='true'></i> " . $details['linked_name'];
$html .= $details['address'];
if ( tribe_show_google_map_link( $current ) ) {
$html .= tribe_get_map_link_html( $current );
}
$html .= '</div>';
} else {
$html .= "<div class='event-location'>Location: TBD</div>";
}
if ( has_excerpt( $current->ID ) ) {
$html .= "<div class='event-content'>" . $current->post_excerpt . '</div>';
} else {
$html .= "<div class='event-content'>No description found.</div>";
}
echo $html;
}
} else {
// we cannot find the plugin as the function tribe_get_events does not exist.
echo 'The Event Calendar plugin cannot be found!';
}// End if().
?>
</div>
<?php
if ( ! empty( $events ) ) {
// we only want to show the See All Events button if a future event exists.
$events_url = get_site_url() . '/events/';
echo '<a class="uw-btn btn-sm" href="' . esc_url( $events_url ) . '"?>See All Events</a>';
}
?>
</div>
<h3 class="isc-admin-header">Known Issues</h3>
<div class="contact-widget-inner isc-widget-gray isc-admin-block">
<div class='post-content'>
<?php
$args = array(
'hierarchical' => false,
'post_type' => 'page',
'post_status' => 'publish',
'meta_key' => 'isc-featured',
'meta_value' => 'seasonal',
);
$seasonal_featured = get_pages( $args );
if ( ! $seasonal_featured ) {
echo '<p>No featured seasonal topics found.</p>';
} else {
foreach ( $seasonal_featured as $featured_page ) {
$html = '<h4><a href="' . get_post_permalink( $featured_page->ID ) . '">' . get_the_title( $featured_page->ID ) . '</a></h4>';
$html .= "<p style='margin-bottom:1.5em;'>";
$custom = get_post_custom( $featured_page->ID );
$description = $custom['isc-featured-description'][0];
if ( '' !== $description ) {
$html .= $description;
} else {
$html .= 'No promotional text available.';
}
$html .= '</p>';
echo $html;
}
}
?>
</div>
<a class="uw-btn btn-sm" href="<?php echo esc_url( get_site_url() . '/seasonal-topics' ); ?>">See all Topics</a>
</div>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>