-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-group.php
67 lines (47 loc) · 967 Bytes
/
page-group.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
<?php
/**
* Template Name: Group
*
*
* @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
$slug = $post->post_name;
$parent_slug = $post->parent_name;
$cat = get_category_by_slug( $slug );
if( $cat ) {
$photos = get_posts( array(
'post_type' => 'photo',
'nopaging' => true,
'cat' => $cat->term_id
) );
if ( $photos ) {
foreach ( $photos as $photo ) { ?>
<div class="photo-post">
<h2>
<a href="<?= get_permalink( $photo ) ?>">
<?= $photo->post_title; ?>
</a>
</h2>
<div class="photo-content">
<?= $photo->post_content; ?>
</div>
</div>
<?php }
} else { ?>
<h2>Nothing here.</h2>
<?php }
} else { ?>
<h2>Nothing here.</h2>
<?php } ?>
</main><!-- .site-main -->
<?php
get_footer();