-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
120 lines (93 loc) · 3.04 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
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
<?php
/**
* The main template file
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package birthday
*/
get_header(); ?>
<div id="sidebar">
<h1 class="site-title desktop"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">Poster Series</a></h1>
<div id="pages" class="desktop">
<?php
$page_args = array(
'sort_column' => 'menu_order',
'order' => 'ASC'
);
$pages = get_pages($page_args);
foreach($pages as $page) {
?>
<div class="page">
<h2 class="entry-title"><?php echo $page->post_title ?></h2>
<?php echo apply_filters('the_content', $page->post_content) ?>
</div>
<?php
} // foreach($categories
?>
</div>
</div>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
//for each category, show 5 posts
$cat_args = array(
'orderby' => 'name',
'order' => 'DESC'
);
$categories = get_categories($cat_args);
foreach($categories as $category) {
$args=array(
'orderby' => 'date',
'order' => 'ASC',
'category__in' => array($category->term_id),
'caller_get_posts'=>1
);
$posts = get_posts($args);
if ($posts) {
echo '<h2 class="category">' . $category->name . '</h2> ';
echo '<div class="poster-thumbs">';
foreach($posts as $post) {
setup_postdata($post); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php esc_url( the_permalink( ) ) ?>" rel="bookmark">
<img class="poster-thumb" src="<?php echo get_post_meta( get_the_ID(), 'poster_setup_full-poster', true ); ?>" />
</a>
<div class="entry-caption">
<div class="caption-number">Poster #<?php echo get_post_meta( get_the_ID(), 'poster_setup_poster-number', true ); ?></div>
<div class="caption-for">for <?php echo get_post_meta( get_the_ID(), 'poster_setup_poster-for', true ); ?></div>
<div class="caption-date"><?php echo date( 'F jS, Y', strtotime( get_post_meta( get_the_ID(), 'poster_setup_poster-date', true ) ) ); ?></div>
</div>
</article>
<?php
} // foreach($posts
echo '</div>';
} // if ($posts
} // foreach($categories
?>
</main><!-- #main -->
</div><!-- #primary -->
<div id="pages" class="tablet">
<?php
$page_args = array(
'sort_column' => 'menu_order',
'order' => 'ASC'
);
$pages = get_pages($page_args);
foreach($pages as $page) {
?>
<div class="page">
<h2 class="entry-title"><?php echo $page->post_title ?></h2>
<?php echo apply_filters('the_content', $page->post_content) ?>
</div>
<?php
} // foreach($categories
?>
</div>
<?php
get_footer();