-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle-practices.php
More file actions
354 lines (296 loc) · 10.2 KB
/
single-practices.php
File metadata and controls
354 lines (296 loc) · 10.2 KB
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
<?php
get_header();
$this_post = $post;
$this_post_id = $post->ID;
$custom = get_post_custom( $post->ID );
$tagline = $custom["tagline"][0];
$description = $custom["description"][0];
$attorney_title = ( $custom["attorney_title"][0] ) ? $custom["attorney_title"][0] : 'Practice Contact';
$chair_id = $custom["chair_id"][0];
$attorney_title_2 = $custom["attorney_title_2"][0];
$chair_id_2 = $custom["chair_id_2"][0];
$rep_matters = $custom["rep_matters"][0];
$areas_focus = get_post_meta( $post->ID, 'areas_focus', true );
$practices_attorneys = get_post_meta( $post->ID, 'practices_attorneys', true );
$industries = get_post_meta( $post->ID, 'industry', 'single' );
if ( $chair_id_2 ) {
$attorney_title = $attorney_title . 's';
}
?>
<div id="primary" class="content-area terminal-page">
<header class="page-header">
<div class="span12 aligncenter">
<h1 class="page-title"><?php the_title(); ?></h1>
</div>
</header><!-- .entry-header -->
<main id="main" class="site-main span12 aligncenter clear" role="main">
<aside class="aside aside-left span2 push-left">
<div class="border-block top">
<h3 class="block-label">Practices</h3>
<?php
$practices = new WP_Query( array(
'post_type' => 'practices',
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page' => 100
) );
while ( $practices->have_posts() ) : $practices->the_post();
?>
<ul>
<li class="<?php echo $post->post_name; ?>">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
</ul>
<?php endwhile; ?>
</div>
</aside>
<section class="span6 push-left">
<article class="block-2 practice-content">
<div class="entry-content">
<?php echo ( $tagline ) ? '<h2>' . $tagline . '</h2>' : ''; ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
</article>
</section>
<aside class="aside aside-right">
<div class="border-block top">
<?php if ( $chair_id && get_post( $chair_id ) ) : ?>
<h3 class="block-label"><?php echo $attorney_title; ?></h3>
<div class="block-person border-block top-right">
<?php
// Get Attorney by Id
$practice_chair = get_post_meta( $chair_id );
$chair_name = $practice_chair['first_name'][0] . ' ';
$chair_name .= $practice_chair['middle_initial'][0] . ' ';
$chair_name .= $practice_chair['last_name'][0];
$chair_phone = $practice_chair['phone'][0];
$chair_email = $practice_chair['email'][0];
// Get Attorney URL
$get_chair = get_post( $chair_id );
$chair_url = $get_chair->guid;
?>
<div class="holder">
<h3 class="block-label"><a href="<?php echo get_permalink( $chair_id ); ?>"><?php echo $chair_name; ?></a></h3>
<p>
P: <?php echo $chair_phone; ?>
</p>
<ul class="links">
<?php if ( $chair_email ) : ?>
<li class="link-mail"><a href="mailto:<?php echo $chair_email; ?>">Email</a></li>
<?php endif; ?>
</ul>
</div>
</div>
<?php endif; ?>
<?php if ( $chair_id_2 && get_post( $chair_id_2 ) ) : ?>
<div class="block-person border-block top-right">
<?php
// Secondary Practice Contact
// Get Attorney by Id
$practice_chair = get_post_meta( $chair_id_2 );
$chair_name = $practice_chair['first_name'][0] . ' ';
$chair_name .= $practice_chair['middle_initial'][0] . ' ';
$chair_name .= $practice_chair['last_name'][0];
$chair_phone = $practice_chair['phone'][0];
$chair_email = $practice_chair['email'][0];
// Get Attorney URL
$get_chair = get_post( $chair_id_2 );
$chair_url = $get_chair->guid;
?>
<div class="holder ">
<h3 class="block-label"><a href="<?php echo get_permalink( $chair_id_2 ); ?>"><?php echo $chair_name; ?></a></h3>
<p>
P: <?php echo $chair_phone; ?>
</p>
<ul class="links">
<?php if ( $chair_email ) : ?>
<li class="link-mail"><a href="mailto:<?php echo $chair_email; ?>">Email</a></li>
<?php endif; ?>
</ul>
</div>
</div>
<?php endif; ?>
<div class="border-block top">
<h3 class="block-label top">Practicing Attorneys</h3>
<ul>
<?php
// Get current page title, and remove special characters
$current_practice = get_the_title();
$current_practice = str_replace( ',', '', $current_practice );
$current_practice = str_replace( '&', '', $current_practice );
// Get all Attorneys
$loop = new WP_Query( array(
'post_type' => 'attorneys',
'meta_key' => 'last_name',
'orderby' => 'meta_value',
'order' => 'ASC',
'posts_per_page' => 1000
) );
while ( $loop->have_posts() ) : $loop->the_post();
$custom = get_post_custom( $post->ID );
$name = $custom["first_name"][0] . ' ';
$name .= $custom["middle_initial"][0] . ' ';
$name .= $custom["last_name"][0];
$areas_practice = get_post_meta( $post->ID, 'areas_practice', true );
// Only show Attorneys where areas of practice match current page
if (
( is_array( $areas_practice ) && in_array( $current_practice, $areas_practice ) ) ||
( is_array( $practices_attorneys ) && in_array( $post->ID, $practices_attorneys ) )
) :
?>
<li>
<a href="<?php the_permalink() ?>"><?php echo $name; ?></a>
</li>
<?php
endif;
endwhile;
?>
</ul>
</div>
<?php if ( $industries ) : ?>
<div class="border-block top industry">
<h3 class="block-label">Industries</h3>
<ul>
<?php foreach ( $industries as $industry ) : ?>
<li>
<a href="<?php echo get_the_permalink( $industry ); ?>"><?php echo get_the_title( $industry ); ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php wp_reset_postdata(); ?>
<?php
$args = array(
'post_type' => 'post',
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => $this_post->post_name
)
)
);
$posts = new WP_Query( $args );
if ( $posts->have_posts() ) : ?>
<a class="button" href="<?php echo esc_url( home_url( '/' ) ) . 'news-events/practice/' . $post->post_name . '/'; ?>">View <?php the_title(); ?> Blog Posts
<span class="icon-arrow-right"></span>
</a>
<?php endif; ?>
</div>
</aside>
<section class="bottom-matter">
<div class="menu span3 push-left">
<h3 class="rep-matters menu-item border-block top-right active">Representative Matters</h3>
<h3 class="articles menu-item border-block top-right">Insights</h3>
<h3 class="news menu-item border-block top-right">News</h3>
</div>
<div class="sections span6 push-left">
<h3 class="rep-matters section-title border-block top-right active">Representative Matters</h3>
<section class="rep-matters bottom-section border-block top-right-bottom active">
<?php echo $rep_matters; ?>
</section>
<?php if ( ! $rep_matters ) : ?>
<script type="text/javascript">
jQuery(function ($) {
$(function () {
$('.rep-matters').remove();
});
});
</script>
<?php endif; ?>
<h3 class="articles section-title border-block top-right">Insights</h3>
<section class="articles bottom-section border-block top-right-bottom ">
<?php
$loop = new WP_Query( array(
'post_type' => 'articles',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => 100
) );
$i = 0;
while ( $loop->have_posts() ) : $loop->the_post();
$custom = get_post_custom( $post->ID );
$pub_summary = ( isset( $custom["pub_summary"] ) ) ? $custom["pub_summary"][0] : false;
$date = get_the_date( 'm/d/y' );
if ( $pub_summary ) {
$pub_summary = strip_tags( $pub_summary );
if ( strlen( $pub_summary ) > 350 ) {
$pub_summary = preg_replace( '/\s+?(\S+)?$/', '', substr( $pub_summary, 0, 350 ) );
$pub_summary .= '…';
}
}
$pub_practices = get_post_meta( $post->ID, 'pub_practices', true );
if ( is_array( $pub_practices ) && in_array( $this_post_id, $pub_practices ) ) :
?>
<div class="date"><?php echo $date; ?></div>
<h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
<?php
$i ++;
endif;
endwhile;
if ( $i == 0 ) : ?>
<script type="text/javascript">
jQuery(function ($) {
$(function () {
$('.articles').remove();
});
});
</script>
<?php endif; ?>
</section>
<h3 class="news section-title border-block top-right">News</h3>
<section class="news bottom-section border-block top-right-bottom ">
<?php
$loop = new WP_Query( array(
'post_type' => 'news',
'meta_key' => 'date',
'orderby' => 'meta_value',
'order' => 'DESC',
'posts_per_page' => 100
) );
$i = 0;
while ( $loop->have_posts() ) : $loop->the_post();
$custom = get_post_custom( $post->ID );
$date = $custom["date"][0];
$fix_date = explode( '/', $date );
$fix_date = $fix_date[1] . '/' . $fix_date[2] . '/' . $fix_date[0];
$source = $custom["source"][0];
$source_url = $custom["source_url"][0];
$news_practices = get_post_meta( $post->ID, 'news_practices', true );
$news_type_select = $custom["news_type_select"][0];
$link_target = ( $news_type_select == 'external' || $news_type_select == 'pdf' ) ? 'target="_blank"' : '';
if ( $news_type_select == 'internal' ) {
$source_url = get_permalink();
}
$attachments = attachments_get_attachments();
if ( $attachments ) {
$pdf = $attachments[0]['location'];
} else { $pdf = ''; }
if ( $pdf ) {
$source_url = $pdf;
}
if ( is_array( $news_practices ) && in_array( $this_post_id, $news_practices ) ) :
?>
<div class="date"><?php echo $fix_date; ?> | Source: <?php echo $source; ?></div>
<h5><a href="<?php echo $source_url; ?>" <?php echo $link_target; ?>><?php the_title(); ?></a></h5>
<?php
$i ++;
endif;
endwhile;
if ( $i == 0 ) : ?>
<script type="text/javascript">
jQuery(function ($) {
$(function () {
$('.news').remove();
});
});
</script>
<?php endif; ?>
</section>
</div>
</section>
</main>
<?php get_footer();