-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
129 lines (92 loc) · 4.46 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
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
<?php get_header(); ?>
<main class="dark-theme">
<section class="news-hero-top category">
<div class="area flex gap-50 align-bottom news-top-area">
<div class="resp-logo">
<img src="img/logos/logo-white.svg">
</div>
<div class="col-8">
<div class="sub-section flex align-center">
<div class="icon small">
<img src="<?php echo get_template_directory_uri(); ?>/img/icons/education.svg" />
</div>
<div class="breadcrumbs">
<a href="<?php echo home_url(); ?>/knowledge/">Hypha Knowledge</a> >
<?php echo $wp_query->found_posts; ?> results for:
</div>
</div>
<p class="title-medium white"><?php the_search_query(); ?></p>
</div>
<div class="col-4 has-search-form">
<?php get_search_form(); ?>
</div>
</section>
<section class="cat-article-wrap">
<div class="area wrap flex gap-20">
<?php if ( have_posts() ) :
// Do we have any posts/pages in the databse that match our query?
?>
<?php while ( have_posts() ) : the_post();
// If we have a page to show, start a loop that will display it
?>
<div class="col-4">
<article id="post-<?php the_ID(); ?>" class="news-item">
<div class="wrappo">
<?php
if ( !has_post_format( 'video' )) {
?>
<div class="top-right-link">
<img src="<?php echo get_template_directory_uri(); ?>/img/icons/top-right-link.svg">
</div>
<?php } ?>
<a href="<?php the_permalink(); ?>">
<?php $medium_large = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'medium_large');?>
<img class="news-thumb" src="<?php echo esc_url($medium_large['0']); ?>" loading="lazy" />
<?php
if ( has_post_format( 'video' )) {
?>
<div class="player-icon">
<img
src="http://localhost:8000/wp-content/themes/hypha2023/img/icons/play-big-icon.svg">
</div>
<?php } ?>
<h3 class="text-24"><?php the_title(); ?></h3>
</a>
<p>
<?php echo wp_kses_post( wp_trim_words( $post->post_content, 26 ) ); ?>
</p>
<div class="author-meta gap-10 flex align-center">
<?php echo get_avatar( get_the_author_meta( 'ID' ), 96 ); ?>
<p class="text-14 bold white">
<?php $fname = get_the_author_meta('first_name');
echo $fname; ?>
</p>
<p class="text-12 grey">
<i><?php $post_date = get_the_date( 'j M, Y' ); echo $post_date; ?></i>
</p>
</div>
</div>
</article>
</div>
<?php
endwhile; ?>
<?php else : // Well, if there are no posts to display and loop through, let's apologize to the reader (also your 404 error) ?>
<div class="col-full no-results">
<p class="title-big">We are sorry, no content is available for your search.</p>
</div>
<?php endif;
?>
</div>
<div class="area blog-navigation flex align-center justify-center">
<div class="pagination-blog">
<div class="past-page">
<?php previous_posts_link( __( '< Newer Articles', 'textdomain' ) ); // Display a link to newer posts, if there are any, with the text 'newer' ?>
</div>
<div class="next-page">
<?php next_posts_link( __( 'Older Articles >', 'textdomain' ) ); // Display a link to older posts, if there are any, with the text 'older' ?>
</div>
</div>
</div>
</section>
</main>
<?php get_footer(); ?>