-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
101 lines (92 loc) · 2.92 KB
/
search.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
<?php
/**
* The template for displaying search pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package CongGiao
*/
get_header();
$catDefault = cg_gen_get_archives_default('other_default');
$isSidebar = ($catDefault['sidebar'] == 'y') ? "sidebar-".$catDefault['sidebarpost'] : '';
$columnDiv = "<div class='column is-12-mobile is-6-tablet is-4-desktop'>";
switch ($catDefault['columns']) {
case 'c1':
$columnDiv = "<div class='column is-12-mobile is-12-tablet is-12-desktop c1'>";
break;
case 'c2':
$columnDiv = "<div class='column is-12-mobile is-6-tablet is-6-desktop c2'>";
break;
case 'c3':
$columnDiv = "<div class='column is-12-mobile is-6-tablet is-4-desktop c3'>";
break;
case 'c4':
$columnDiv = "<div class='column is-6-mobile is-4-tablet is-3-desktop c4'>";
break;
default:
# code...
break;
}
?>
<div class="header-section">
<div class="container">
<h1 class="title"><?php echo 'Kết quả tìm kiếm: '.get_search_query(); ?></h1>
</div>
</div>
<?php
if ($catDefault['sidebar'] == 'n'){
echo '<div class="container">';
echo '<main id="main" class="site-main content-area">';
echo "<div class='columns is-mobile is-variable is-2 is-multiline'>";
if ( have_posts() ) :
/* Start the Loop */
while ( have_posts() ) : the_post();
echo $columnDiv;
include( locate_template('template-parts/content-archive.php') );
//get_template_part( 'template-parts/content', 'archive' );
echo "</div>";
endwhile;
//the_posts_navigation();
else :
get_template_part( 'template-parts/content', 'none' );
endif;
echo "</div>";
echo '<nav class="pagination is-medium" role="navigation" aria-label="pagination">';
wp_pagenavi();
echo '</nav>';
echo '</main>';
echo "</div>";
} else { ?>
<div class="container">
<div class="columns <?php echo $isSidebar; ?>">
<div id="primary" class="content-area column <?php echo ($catDefault['sidebar'] == 'y') ? 'is-9' : '';?>">
<main id="main" class="site-main">
<div class="columns archive-posts is-mobile is-variable is-2 is-multiline">
<?php
if ( have_posts() ) :
/* Start the Loop */
while ( have_posts() ) : the_post();
echo $columnDiv;
include( locate_template('template-parts/content-archive.php') );
echo "</div>";
endwhile;
else :
get_template_part( 'template-parts/content', 'none' );
endif; ?>
</div><!-- columns -->
<nav class="pagination is-medium" role="navigation" aria-label="pagination">
<?php wp_pagenavi(); ?>
</nav>
</main><!-- #main -->
</div><!-- #primary -->
<?php
if ( is_active_sidebar( 'widget-archive' ) ) {
echo '<aside id="sidebar" class="widget-area column is-3">';
dynamic_sidebar( 'widget-archive' );
echo '</aside>';
}
?>
</div><!-- Columns -->
</div><!-- Container -->
<?php } ?>
<?php get_footer();