-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
50 lines (46 loc) · 1.01 KB
/
index.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
<?php
/**
* The main template file
*
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package WordPress
* @subpackage Four Corners Exhibit
* @since 1.0.0
*/
get_header();
global $post;
?>
<main id="main" class="site-main">
<?php
$cats = get_terms( array(
'taxonomy' => 'category',
'hide_empty' => false,
'parent' => 0,
'exclude' => 1
) );
if ( $cats ) {
foreach( $cats as $cat ) { ?>
<div class="cat">
<a href="<?= get_category_link( $cat ); ?>"><?= $cat->name; ?></a>
<?php $sub_cats = get_terms( array(
'taxonomy' => 'category',
'hide_empty' => false,
'parent' => $cat->term_id
) );
if( $sub_cats && sizeof( $sub_cats ) > 1 ) { ?>
<div class="sub-cats">
<?php foreach( $sub_cats as $sub_cat ) { ?>
<a href="<?= get_category_link( $sub_cat ); ?>"><?= $sub_cat->name; ?></a>
<?php } ?>
</div>
<?php } ?>
</div>
<?php }
} else { ?>
<h2>No photos to exhibit.</h2>
<?php } ?>
</main>
<?php
get_footer();