-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
executable file
·133 lines (117 loc) · 3.43 KB
/
single.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
<?php get_header(); ?>
<main class="page" id="main-content">
<div class="hero">
<div class="hero__container container--purple">
<!-- REGION: Breadcrumb -->
<?php get_template_part('modules/_breadcrumbs'); ?>
<!-- /REGION: Breadcrumb -->
<h1 class="hero__title"><?php the_title(); ?></h1>
</div>
</div>
<div class="main">
<div class="main__inner right_sidebar">
<div id="sidebar" class="sidebar sidebar--header">
<?php
$related = get_related_programs( get_the_ID() );
// if we have related page ids
if ( !empty( $related ) ) {
// query for all the related programs
$related_query = new WP_Query( array(
'post_type' => 'page',
'post__in' => $related,
'post_parent' => 30
));
if ( $related_query->have_posts() ) {
?>
<div class="related-programs">
<h4>Related Programs</h4>
<?php
while( $related_query->have_posts() ) : $related_query->the_post();
?>
<div class="program">
<a href="<?php the_permalink(); ?>">
<div class="program-image"><?php the_post_thumbnail(); ?></div>
<div class="program-title"><h6><?php the_title(); ?></h6></div>
</a>
</div>
<?php
endwhile;
wp_reset_postdata();
?>
</div>
<?php
}
}
// get the post category ids
$category_ids = wp_get_post_categories( get_the_ID() );
// if we have related page ids
if ( !empty( $category_ids ) ) {
// query for all the related programs
$related_posts_query = new WP_Query( array(
'post_type' => 'post',
'cat_in' => $category_ids,
'post__not_in' => array( get_the_ID() ),
'posts_per_page' => 4
));
if ( $related_posts_query->have_posts() ) {
?>
<div class="related-posts">
<h4>Related Posts</h4>
<ul>
<?php
while( $related_posts_query->have_posts() ) : $related_posts_query->the_post();
?>
<li class="related-post">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php
endwhile;
wp_reset_postdata();
?>
</ul>
</div>
<?php
}
}
if ( has_nav_menu( 'action_news' ) ) { ?>
<div class="related-posts">
<h4>Connect With Us</h4>
<?php
wp_nav_menu([
'theme_location' => 'action_news',
'menu_class' => 'subnav action-news',
'li_class' => '',
'link_class' => 'button--gold',
'container' => ''
]);
?>
</div>
<?php
}
?>
</div>
<div class="main__side">
<?php $lede = get_field('lede'); ?>
<?php if( $lede ) : ?>
<p class="text-intro"><?php echo $lede; ?></p>
<?php endif; ?>
<?php
$post_type = get_field( 'post_type' );
?>
<?php if(get_the_date('F j, Y') && ($post_type=='news' || $post_type=='announcement' || $post_type=='britons')) : ?>
<p><?php the_date('F j, Y'); ?></p>
<?php endif; ?>
<?php if ( post_password_required() ) :
echo get_the_password_form();
elseif( ! post_password_required() ) : ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php while (have_rows('main_column_modules')) : the_row(); ?>
<?php get_template_part('modules/_' . get_row_layout()); ?>
<?php endwhile; ?>
<?php endwhile; endif; wp_reset_postdata(); ?>
<?php endif; ?>
</div>
</div>
</div>
</main>
<?php get_footer(); ?>