-
Notifications
You must be signed in to change notification settings - Fork 0
/
taxonomy-occasion.php
61 lines (48 loc) · 1.13 KB
/
taxonomy-occasion.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
<?php
get_header();
$term = get_queried_object();
$breadcrumbs = array();
$debug_counter = 0;
$breadcrumb_term = $term;
while($breadcrumb_term->parent) {
if($debug_counter++ > 100) {
var_dump("Too long");
break;
}
$parent = get_term($breadcrumb_term->parent, 'occasion');
$breadcrumbs[] = $parent;
$breadcrumb_term = $parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach($breadcrumbs as $breadcrumb_term) {
echo('<a href="'.get_term_link($breadcrumb_term).'">'.$breadcrumb_term->name.'</a> >');
}
echo '<h1>' . esc_html($term->name) . '</h1>';
?>
En snacks för varje tillfälle
<?php
$terms = get_terms(array(
'taxonomy' => 'occasion',
'hide_empty' => false,
'parent' => $term->term_id,
));
if($terms) {
foreach($terms as $term) {
echo('<a href="'.get_term_link($term).'">'.$term->name.'</a>');
}
}
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
?>
<a href="<?php echo(get_permalink($post->ID)); ?>">
<?php
the_title();
?>
</a>
<?php
endwhile;
endif;
?>
<?php
get_footer();