-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
149 lines (99 loc) · 3.48 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
/**
* The template for displaying search results pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* @package WordPress
* @subpackage Twenty_Seventeen
* @since 1.0
* @version 1.0
*/
get_header(); ?>
<div class="wrap">
<header class="page-header">
<?php if ( have_posts() ) : ?>
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyseventeen' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
<?php else : ?>
<h1 class="page-title"><?php _e( 'Nothing Found', 'twentyseventeen' ); ?></h1>
<?php endif; ?>
</header><!-- .page-header -->
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
if ( have_posts() ) {
?>
<div class="posts-archive-wrapper">
<?php
$num_post = 1;
/* Start the Loop */
while ( have_posts() ) : the_post();
$post_thumbnail_id = 0;
if ( '' !== get_the_post_thumbnail() ){
$post_thumbnail_id = get_post_thumbnail_id( get_the_ID() );
}
$img = get_sed_attachment_image_html( $post_thumbnail_id , "" , "500X330" );
if ( ! $img ) {
$img = array();
$img['thumbnail'] = '<img class="sed-image-placeholder sed-image" src="' . sed_placeholder_img_src() . '" />';
}
$excerpt_length = 440;
$content_post = apply_filters( 'the_excerpt', get_the_excerpt() );
if( strlen( $content_post ) > $excerpt_length )
$content_post = mb_substr( $content_post , 0 , $excerpt_length - 3 ) . '...';
?>
<div class="posts-archive-item">
<div class="tme-wrapper row">
<?php if( $num_post % 2 == 1 ) { ?>
<div class="col-sm-6">
<div class="tme-img">
<?php echo $img['thumbnail'];?>
</div>
</div>
<?php } ?>
<div class="col-sm-6">
<div class="tme-heading">
<div class="tme-heading-inner">
<h4><?php the_title();?></h4>
<div><?php echo __("Updated On:" , "omid") . " " .twentyseventeen_time_link();?></div>
</div>
</div>
<div class="tme-content">
<div class="tme-content-inner">
<?php echo $content_post;?>
</div>
<div class="tme-btn"><a href="<?php the_permalink();?>" class="text-first-main"><?php echo __("Read More","omid");?></a></div>
</div>
</div>
<?php if( $num_post % 2 == 0 ) { ?>
<div class="col-sm-6">
<div class="tme-img">
<?php echo $img['thumbnail'];?>
</div>
</div>
<?php } ?>
</div>
</div>
<?php
$num_post++;
endwhile;
?>
</div>
<?php
the_posts_pagination( array(
'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>',
'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>',
) );
}else{
?>
<p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'twentyseventeen' ); ?></p>
<?php
get_search_form();
}
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div><!-- .wrap -->
<?php get_footer();