-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-colecciones.php
executable file
·97 lines (85 loc) · 2.37 KB
/
page-colecciones.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
<?php
/*
Template Name: Colecciones
*/
get_header();
?>
<!-- main content -->
<main id="main-content">
<!-- main posts loop -->
<section id="posts" class="container">
<?php
$categories = get_terms('category', array('orderby' => 'id', 'hide_empty' => true));
if ($categories) {
foreach($categories as $i => $category) {
?>
<div class="row collection">
<?php
if ($i % 2 !== 0) {
?>
<div class="col col-8">
<h2><?php echo $category->name; ?></h2>
<p><?php echo $category->description; ?></p>
</div>
<?php
} else {
?>
<div class="col col-2"></div>
<div class="col col-6">
<h2><?php echo $category->name; ?></h2>
<p><?php echo $category->description; ?></p>
</div>
<?php
}
$books = get_posts(array(
'category' => $category->term_taxonomy_id,
));
if ($books) {
?>
<div class="col col-4">
<h2><?php echo __('[:es]Títulos[:en]Titles'); ?></h2>
<?php
foreach ($books as $book) {
$releaseDate = get_post_meta($book->ID, '_igv_release_date');
if (!empty($releaseDate)) {
if (qtranxf_getLanguage() == 'es') {
$locale = 'es_ES';
} else {
$locale = 'en_US';
}
\Moment\Moment::setLocale($locale);
$m = new \Moment\Moment($releaseDate[0]);
?>
<div class="collection-book font-mono u-cf">
<div class="book-image"><a href="<?php echo get_permalink($book->ID); ?>"><?php echo get_the_post_thumbnail($book->ID, 'book-cover'); ?></a></div>
<span class="book-date"><a class="color-black" href="<?php echo get_permalink($book->ID); ?>"><?php echo $m->format('M Y'); ?></a></span>
<a href="<?php echo get_permalink($book->ID); ?>"><?php echo $book->post_title; ?></a>
</div>
<?php
} else {
?>
<div class="collection-book font-mono u-cf">
<div class="book-image"><img src="<?php bloginfo('stylesheet_directory'); ?>/img/dist/e-mp-blank.jpg" /></div>
<span class="book-date"><?php echo __('[:es]Próximo[:en]Soon'); ?></span>
<?php echo $book->post_title; ?>
</div>
<?php
}
}
?>
</div>
<?php
}
?>
</div>
<?php
}
}
?>
<!-- end posts -->
</section>
<!-- end main-content -->
</main>
<?php
get_footer();
?>