-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
151 lines (133 loc) · 7.86 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
150
151
<?php get_header(); ?>
<main id="main" class="row" role="main">
<section id="featured" class="section no-pad-bot">
<div id="content" class="container">
<header class="row card page-header">
<div class="col s12">
<h2 class="page-title"><?php printf( __( '"%s" ile ilgili sonuçlar', 'yoldanciktim' ), '<span>' . get_search_query() . '</span>' ); ?></h2>
<?php
global $wp_query;
if($wp_query->found_posts > 0):
?>
<?php echo '<h3>Toplam '.$wp_query->found_posts.' ilgili içerik bulundu.</h3>'; ?>
</div>
</header><!-- .page-header -->
<div class="row">
<aside class="featured-post col s12 m8 l8 xl8">
<h4>+ <?php echo get_search_query(); ?> İle İlgili Yazılmış Son Yazı<span class="line"></span></h4>
<?php
$query1 = new WP_Query( array( 'posts_per_page' => 1, 's' => $s ) );
if ( $query1->have_posts() ) {
while ( $query1->have_posts() ) {
if (in_array($post_id, $do_not_duplicate)) { continue; }
$do_not_duplicate[] = get_the_ID();
$query1->the_post();
?>
<div class="card">
<figure class="card-image waves-effect">
<a href="<?php echo get_permalink($recent["ID"]); ?>" title="<?php echo get_the_title(); ?>">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail('featured-post'); } ?>
</a>
<figcaption class="card-title">
<a href="<?php echo get_permalink($recent["ID"]); ?>" rel="bookmark" title="<?php echo get_the_title(); ?>"><?php echo get_the_title(); ?></a>
</figcaption>
</figure>
</div>
<?php
}
wp_reset_postdata();
}
?>
</aside>
<div class="latest-post col s12 m4 l3 xl3">
<h4>+ <?php echo get_search_query(); ?> Hakkında Öne Çıkanlar<span class="line"></span></h4>
<div class="row">
<?php
$query2 = new WP_Query( array( 'posts_per_page' => 2, 'orderby' => 'rand', 's' => $s ) );
if ( $query2->have_posts() ) {
while ( $query2->have_posts() ) {
if (in_array($post_id, $do_not_duplicate)) { continue; }
$do_not_duplicate[] = get_the_ID();
$query2->the_post();
?>
<aside>
<div class="card">
<figure class="card-image waves-effect">
<a href="<?php echo get_permalink($recent["ID"]); ?>" title="<?php echo get_the_title(); ?>">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail('popular-posts'); } ?>
</a>
<figcaption class="card-title">
<a href="<?php echo get_permalink($recent["ID"]); ?>" rel="bookmark" title="<?php echo get_the_title(); ?>"><?php echo get_the_title(); ?></a>
</figcaption>
</figure>
</div>
</aside>
<?php
}
wp_reset_postdata();
}
?>
</div>
</div>
<div class="collection social-media-links col s1 m1 l1 xl1 hide-on-med-and-down">
<h6>Sosyal Medya</h6>
<a href="http:https://facebook.com/yoldanciktimcom" class="collection-item transparent waves-effect"><i class="fa fa-facebook-square" aria-hidden="true"></i> <span>Facebook</span></a>
<a href="http:https://instagram.com/yoldanciktimcom" class="collection-item transparent waves-effect"><i class="fa fa-instagram" aria-hidden="true"></i> <span>Instagram</span></a>
<a href="http:https://youtube.com/yoldanciktimcom?utm_medium=homepage&utm_campaign=badge&utm_term=Youtube&utm_content=text-link" class="collection-item transparent waves-effect"><i class="fa fa-youtube-play" aria-hidden="true"></i> <span>Youtube</span></a>
<a href="http:https://twitter.com/yoldanciktimcom" class="collection-item transparent waves-effect"><i class="fa fa-twitter" aria-hidden="true"></i> <span>Twitter</span></a>
<a href="http:https://pinterest.com/yoldanciktimcom" class="collection-item transparent waves-effect"><i class="fa fa-pinterest" aria-hidden="true"></i> <span>Pinterest</span></a>
</div>
</div>
</div>
</section>
<section id="essential-live" class="section no-pad-bot">
<div class="container">
<h3>+ "<?php echo get_search_query(); ?>" Hakkındaki Diğer Yazılar<span class="line"></span></h3>
<div class="row">
<?php
$query6 = new WP_Query( array( 'posts_per_page' => $wp_query->found_posts, 'offset' => 1, 's' => $s ) );
if ( $query6->have_posts() ) {
while ( $query6->have_posts() ) {
if (in_array($post_id, $do_not_duplicate)) { continue; }
$do_not_duplicate[] = get_the_ID();
$query6->the_post();
?>
<aside class="col s12 m6 l4 xl4">
<div class="card">
<figure class="card-image waves-effect">
<a href="<?php echo get_permalink($recent["ID"]); ?>" title="<?php echo get_the_title(); ?>">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail('category-posts'); } ?>
</a>
<figcaption class="card-title">
<a href="<?php echo get_permalink($recent["ID"]); ?>" rel="bookmark" title="<?php echo get_the_title(); ?>"><?php echo get_the_title(); ?></a>
</figcaption>
</figure>
</div>
</aside>
<?php
}
wp_reset_postdata();
}
?>
</div>
</section>
<section>
<div>
<?php else: ?>
<h3>İlgili içerik bulunamadı. Başka bir şekilde aramak ister misin?</h3>
<section class="section row">
<div class="col xl12 nav-wrapper">
<form role="search" method="get" class="search-form black text-white" action="<?php echo home_url( '/' ); ?>?utm_medium=<?php echo $_SERVER['REQUEST_URI']; ?>&utm_campaign=search&utm_term=navigation">
<div class="input-field">
<input id="search-404" type="search" class="search-field text-white" value="<?php echo get_search_query() ?>" title="<?php echo esc_attr_x( 'Search for:', 'label' ) ?>" name="s" placeholder="<?php echo esc_attr_x( 'Ara …', 'placeholder' ) ?>" required>
<label class="label-icon" for="search"><i class="material-icons text-white">search</i></label>
<i class="material-icons close text-white">close</i>
</div>
</form>
</div>
</section>
<?php endif; ?>
</div>
</section>
</main>
<?php get_footer(); ?>