forked from telabotanica/wp-theme-telabotanica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive.php
148 lines (132 loc) · 4.9 KB
/
archive.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
/**
* Page d'accueil
*/
get_header();
$category = get_category( get_query_var('cat') );
$category_actualites = get_category_by_slug( 'actualites' );
$category_emploi = get_category_by_slug( 'offres-emploi' );
$category_evenements = get_category_by_slug( 'evenements' );
$is_category_emploi = is_category( $category_emploi ) || cat_is_ancestor_of( $category_emploi, $category );
$is_category_events = is_category( $category_evenements ) || cat_is_ancestor_of( $category_evenements, $category );
?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
$cover_image = get_field('cover_image', get_queried_object());
if ($is_category_emploi) {
the_telabotanica_module('cover', [
'title' => $category_emploi->name,
'subtitle' => __("Toutes les offres d'emploi, de stage et de service civique", 'telabotanica'),
'image' => $cover_image,
'search' => false
] );
} elseif ($is_category_events) {
the_telabotanica_module('cover', [
'title' => $category_evenements->name,
'subtitle' => __('Tous les évènements à venir', 'telabotanica'),
'image' => $cover_image,
'search' => [
'index' => 'evenements',
'placeholder' => __('Rechercher un évènement...', 'telabotanica'),
'instantsearch' => true
]
] );
} else {
the_telabotanica_module('cover', [
'title' => $category_actualites->name,
'subtitle' => sprintf(
__('Toute l\'<a href="%s">actualité</a>, les <a href="%s">offres d\'emploi</a> et les <a href="%s">évènements</a>', 'telabotanica'),
get_category_link( $category_actualites ),
get_category_link( $category_emploi ),
get_category_link( $category_evenements )
),
'image' => get_field( 'cover_image', get_queried_object() ),
'search' => [
'index' => 'actualites',
'placeholder' => __("Rechercher une actualité...", 'telabotanica'),
'instantsearch' => true
]
] );
}
?>
<div class="layout-content-col">
<div class="layout-wrapper">
<aside class="layout-column">
<?php
$algolia_autocomplete_config = telabotanica_algolia_config()['autocomplete'];
$current_index = $is_category_events ? 'evenements' : 'actualites';
// Retrieve the label for the current index
$indices = $algolia_autocomplete_config['sources'];
foreach ( $indices as $index ) :
if ( $index['index_id'] === $current_index ) {
$current_index = [
'id' => $current_index,
'label' => $index['label'],
'name' => $index['index_name'],
'filters' => @$index['filters'] ?: []
];
break;
}
endforeach;
the_telabotanica_module('categories', [
'modifiers' => 'layout-column-item'
] );
if ( $is_category_events ) :
?>
<div class="layout-column-item background-white with-shadow with-padding">
<?php the_telabotanica_module('button', [
'href' => get_permalink( get_page_by_path( 'proposer-une-actualite' ) ),
'text' => __( 'Proposer un évènement', 'telabotanica' ),
'modifiers' => 'block orange'
] ); ?>
</div>
<div class="layout-column-item background-white with-shadow">
<?php
the_telabotanica_module('map-events');
?>
</div>
<?php
else :
?>
<div class="layout-column-item background-white with-shadow with-padding">
<?php the_telabotanica_module('button', [
'href' => get_permalink( get_page_by_path( 'proposer-une-actualite' ) ),
'text' => __( 'Proposer une actualité', 'telabotanica' ),
'modifiers' => 'block'
] ); ?>
</div>
<?php the_telabotanica_module('newsletter', [
'modifiers' => 'layout-column-item background-white with-shadow with-padding'
] ); ?>
<?php the_telabotanica_module('upcoming-events', [
'modifiers' => 'layout-column-item background-white with-shadow with-padding'
] );
endif;
the_telabotanica_module('search-filters', [
'filters' => $current_index['filters']
]);
the_telabotanica_module('button-top');
?>
</aside>
<div class="layout-content">
<?php
if ( !empty( $category ) ):
$rss_button = sprintf(
'<a href="%s" title="%s" rel="nofollow">%s</a>',
get_category_feed_link( $category->cat_ID ),
esc_attr( sprintf( __( 'Flux RSS %s', 'telabotanica' ), $category->name ) ),
get_telabotanica_module('icon', ['icon' => 'rss', 'color' => 'orange'])
);
endif;
the_telabotanica_module('breadcrumbs', ['button' => $rss_button]);
the_telabotanica_module('list-articles');
// Container for instantsearch hits
echo '<div class="list-articles" id="search-hits"></div>';
?>
</div>
</div>
</div>
</main><!-- .site-main -->
</div><!-- .content-area -->
<?php get_footer(); ?>