forked from telabotanica/wp-theme-telabotanica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-tb_thematique.php
92 lines (69 loc) · 1.98 KB
/
single-tb_thematique.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
<?php
/**
* Thématique
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php the_telabotanica_module('cover'); ?>
<div class="layout-content-col">
<div class="layout-wrapper">
<aside class="layout-column">
<?php
$toc_items = [];
// Si la page utilise des composants
if ( have_rows('components') ) {
$first = true;
// On boucle sur les composants
while ( have_rows('components') ) : the_row();
// On garde seulement les intertitres
if (get_row_layout() !== 'title') continue;
// On garde seulement les intertitres de niveau 2
if (get_sub_field('level') !== '2') continue;
$toc_items[] = [
'active' => $first,
'text' => get_sub_field('title'),
'href' => '#' . get_sub_field('anchor')
];
$first = false;
endwhile;
}
the_telabotanica_module('toc', [
'items' => [
[ 'items' => $toc_items ]
]
] );
the_telabotanica_module('button-top');
?>
</aside>
<div class="layout-content">
<?php
$breadcrumbs_items = [ 'home' ];
$breadcrumbs_items[] = [
'href' => get_post_type_archive_link( 'tb_thematique' ),
'text' => __('Thématiques', 'telabotanica')
];
$breadcrumbs_items[] = [ 'text' => get_the_title() ];
the_telabotanica_module('breadcrumbs', [
'items' => $breadcrumbs_items
]);
?>
<article>
<?php
// Si la page utilise des composants
if( have_rows('components') ):
// On boucle sur les composants
while ( have_rows('components') ) : the_row();
the_telabotanica_component(get_row_layout());
endwhile;
else :
// no layouts found
endif;
?>
</article>
</div>
</div>
</div>
</main><!-- .site-main -->
</div><!-- .content-area -->
<?php get_footer(); ?>