forked from andreondra/stcblog
-
Notifications
You must be signed in to change notification settings - Fork 1
/
search.php
executable file
·76 lines (74 loc) · 3.38 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
<?php
/**
* Search page.
* @copyright Copyright (C) 2020 Ondrej Golasowski
* @license GPL(GPLv3)
*/
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="<?php echo get_bloginfo('template_directory') . get_css_name();?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Vyhledávání: <?php echo get_search_query(); ?> | <?php echo get_bloginfo('name'); ?></title>
<?php wp_head(); ?>
</head>
<body class="ms-Fabric">
<?php get_header(); ?>
<main class="main search">
<header class="main__header">
<h1><?php echo get_bloginfo('name'); ?></h1>
<p>
<?php
$allsearch = new WP_Query("s=$s&showposts=0");
$count = $allsearch ->found_posts;
switch($count){
case 0:
echo 'Nebyl nalezen žádný výsledek pro: ';
break;
case 1:
echo 'Nalezen 1 výsledek pro: ';
break;
case 2:
case 3:
case 4:
echo 'Nalezeny ' . $count . ' výsledky pro: ';
break;
default:
echo 'Nalezeno ' . $count . ' výsledků pro: ';
break;
}
?>
<em><?php echo get_search_query(); ?></em></p>
</header>
<section class="feed__posts">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<article>
<a class="excerpt" href="<?php the_permalink(); ?>">
<div class="excerpt__thumbnail">
<?php the_post_thumbnail([300, 200]); ?>
</div>
<div class="excerpt__text">
<h2 class="excerpt__text__title"><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<div class="excerpt__text__meta">
<span class="excerpt__text__meta__date"><?php echo get_the_date(); ?></span>
<span>•</span>
<span class="excerpt__text__meta__readtime">Doba čtení: <?php echo reading_time(); ?></span>
<?php if(has_tag('vzorovahodina')==true){
echo("<span id='phone-hide'>•</span><span class='excerpt__text__tag' id='vzorova-hodina'>vzorová hodina</span>");
}
?>
</div>
</div>
</a>
</article>
<?php endwhile; endif; ?>
</section>
<footer class="feed__footer">
<?php include "pagination.php" ?>
</footer>
</main>
<?php get_footer(); ?>
</body>
</html>