-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtaxonomy-characteristic.php
66 lines (64 loc) · 1.84 KB
/
taxonomy-characteristic.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
<?php
get_header(); ?>
<main class="main-content">
<div class="container">
<h1>
<?php
echo get_queried_object()->name;
?>
</h1>
<?php
if ( have_posts() ) { ?>
<div class="blog-grid">
<?php
while ( have_posts() ) {
the_post(); ?>
<article class="card">
<?= wp_get_attachment_image( carbon_get_the_post_meta( 'cr_recipe_featured_image1' ),
'card-illustration',
false,
[ 'class' => 'card-illustration' ] ) ?>
<ul class="card-terms-list">
<?php
$terms = get_the_terms( get_the_ID(), 'characteristic' );
if ( $terms ) {
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, 'characteristic' );
if ( is_wp_error( $term_link ) ) {
continue;
}
echo '<li class="card-terms-item"><a href="' . $term_link . '" class="card-terms-link">' . $term->name . '</a></li>';
}
}
?>
</ul>
<h3 class="card-title"><?php
the_title(); ?></h3>
<ul class="card-meta-list">
<li class="card-meta-item"><?php
if ( intval( date_format( date_create( carbon_get_the_post_meta( 'cr_preparation_time' ) ),
'H' ) ) === 0 ) {
$format = 'i \m\i\n';
} else {
$format = 'G\hi';
}
echo date_format( date_create( carbon_get_the_post_meta( 'cr_preparation_time' ) ),
$format ); ?></li>
<li class="card-meta-item"><?= carbon_get_post_meta( get_the_ID(),
'cr_number_of_portions' ) ?> portion<?php
echo carbon_get_post_meta( get_the_ID(),
'cr_number_of_portions' ) < 2 ? '' : 's' ?></li>
</ul>
<a href="<?php
the_permalink() ?>" class="card-link">Voir la recette</a>
</article>
<?php
} ?>
</div>
<?php
cr_number_pagination();
} ?>
</div>
</main>
<?php
get_footer(); ?>