-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle-study_area.php
More file actions
57 lines (46 loc) · 1.31 KB
/
single-study_area.php
File metadata and controls
57 lines (46 loc) · 1.31 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
<?php
/**
* The main template file
*/
get_header(); ?>
<?php if ( have_posts() ) : ?>
<p class="h4"><a href="<?php echo home_url(); ?>">« Home</a> / Area of Study</p>
<h2><?php the_title(); ?></h2>
<h3>Programs</h3>
<?php
$schools = get_terms('_school');
foreach($schools as $school) :
$args = array(
'post_type'=>'program',
'orderby' => 'title',
'order'=>'ASC',
'posts_per_page'=>500,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => '_school',
'field' => 'slug',
'terms' => $school->slug
),
array(
'taxonomy' => '_study_area',
'field' => 'slug',
'terms' => $post->post_name
)
)
);
$programs = get_posts( $args );
if ( $programs ) : ?>
<h4><a href="<?php echo site_url("school/{$school->slug}/"); ?>"><?php echo $school->name; ?></a></h4>
<ul class="push list-unstyled" style="-webkit-columns: 2">
<?php foreach ( $programs as $program ) : ?>
<li class="hug"><a href="<?php echo get_permalink($program->ID); ?>"><?php echo get_the_title($program->ID); ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php endforeach; ?>
<?php the_content(); ?>
<hr>
<p><a href="<?php echo home_url(); ?>">« Home</a></p>
<?php endif; ?>
<?php get_footer();