search-news.php
4.88 KB
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
<?php
/**
* The template for displaying search results pages
*
* @package Understrap
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
get_header();
?>
<style>
.news-search form li[data-sf-field-name="_sft_category"]{ display: none !important;}
</style>
<div class="wrapper news-search" id="search-wrapper">
<div class="<?php echo esc_attr( $container ); ?> container search-content" id="content" tabindex="-1">
<div class="breadcrumb"><?php get_breadcrumb(); ?><?php _e("News and Events", 'msf'); ?></div>
<h1 class=""><?php _e("News and Events", 'msf'); ?></h1>
<?php //get_search_form() ?>
<button class="btn btn-primary filter" data-bs-toggle="collapse" data-bs-target="#search-sidebar" role="button" aria-expanded="false" aria-controls="search-sidebar" >
<?php _e("SORT AND FILTER", 'msf'); ?>
</button>
<div class="search-wrapper row">
<div class="col-sm-12 col-md-12 col-lg-3 widget-area collapse" id="search-sidebar">
<div id="top-news-select">
<li class="sf-field-category" data-sf-field-name="_sft_category" data-sf-field-type="category" data-sf-field-input-type="radio"><h4><?php _e("SHOW:", 'msf'); ?></h4>
<ul class="">
<?php $my_current_lang = apply_filters( 'wpml_current_language', NULL );
if ($my_current_lang != 'fr'){ ?>
<li class="sf-level-0 sf-item-340" data-sf-count="0" data-sf-depth="0"><input class="sf-input-radio" type="radio" value="events" <?php if($_GET['_sft_category'] == 'events'){ echo 'checked="checked"'; }; ?> name="_sft_category[]" id="sf-input-96986b74c4834549a28504865a382064"><label class="sf-label-radio" for="sf-input-96986b74c4834549a28504865a382064">Events</label></li>
<li class="sf-level-0 sf-item-341 sf-option-active" data-sf-count="4" data-sf-depth="0"><input class="sf-input-radio" type="radio" value="news" name="_sft_category[]" <?php if($_GET['_sft_category'] == 'news'){ echo 'checked="checked"';}; ?> id="sf-input-6606415ce37dedc088bf1e3935d3a087"><label class="sf-label-radio" for="sf-input-6606415ce37dedc088bf1e3935d3a087">News</label></li></ul>
<?php }else{ ?>
<li class="sf-level-0 sf-item-340" data-sf-count="0" data-sf-depth="0"><input class="sf-input-radio" type="radio" value="events-fr" <?php if($_GET['_sft_category'] == 'events-fr'){ echo 'checked="checked"'; }; ?> name="_sft_category[]" id="sf-input-96986b74c4834549a28504865a382064"><label class="sf-label-radio" for="sf-input-96986b74c4834549a28504865a382064">Événements</label></li>
<li class="sf-level-0 sf-item-341 sf-option-active" data-sf-count="4" data-sf-depth="0"><input class="sf-input-radio" type="radio" value="news-fr" name="_sft_category[]" <?php if($_GET['_sft_category'] == 'news-fr'){ echo 'checked="checked"';}; ?> id="sf-input-6606415ce37dedc088bf1e3935d3a087"><label class="sf-label-radio" for="sf-input-6606415ce37dedc088bf1e3935d3a087">Nouvelles</label></li></ul>
<?php }?>
</li>
</div>
<?php echo do_shortcode('[searchandfilter slug="news-search"]'); ?>
<button class="btn btn-primary filter apply-filters" data-bs-toggle="collapse" data-bs-target="#search-sidebar" role="button" aria-expanded="false" aria-controls="search-sidebar" >
<?php _e("APPLY FILTERS", 'msf'); ?>
</button>
</div>
<main class="col-sm-12 col-md-9 content-area site-main search-result" id="main">
<?php //echo do_shortcode('[searchandfilter slug="112" action="filter_next_query"]'); ?>
<?php if ( have_posts() ) :
global $wp_query;
?>
<header class="page-header">
<h3 class="page-title">
<?php
printf(
/* translators: %s: query term */
esc_html__( 'SHOWING: %s', 'understrap' ),
'<span>' .$wp_query->found_posts. '</span>'
);
?>
</h3>
</header><!-- .page-header -->
<?php /* Start the Loop */ ?>
<?php
while ( have_posts() ) :
the_post();
/*
* Run the loop for the search to output the results.
* If you want to overload this in a child theme then include a file
* called content-search.php and that will be used instead.
*/
get_template_part( 'loop-templates/content', 'search' );
endwhile;
?>
<?php else : ?>
<?php get_template_part( 'loop-templates/content', 'none' ); ?>
<?php endif; ?>
<?php understrap_pagination(); ?>
</main><!-- #main -->
<!-- The pagination component -->
</div>
<!-- The pagination component -->
<!-- The pagination component -->
<script>
jQuery(document).ready(function($) {
if ($('html:lang(fr-FR)').length && $('.news-search').length) {
$('.wpml-ls-link').attr('href', document.location.origin + '/news/');
}else if($('.news-search').length){
$('.wpml-ls-link').attr('href', document.location.origin + '/news/?lang=fr');
}
});
</script>
</div><!-- #content -->
</div><!-- #search-wrapper -->
<?php
get_footer();