-
Notifications
You must be signed in to change notification settings - Fork 0
/
search-2.php
329 lines (241 loc) · 14 KB
/
search-2.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* For example, it puts together the home page when no home.php file exists.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
* Lets enhance this and move the epic_reddit_index($agrs) function into this file.
*/
get_header();
?>
<div class='container-fluid'>
<div class='ph-layout-2 ph-list'>
<div class='col-md-2 discuss-sidebar' style='margin-top:80px'>
<?php dynamic_sidebar('ph-home-sidebar'); ?>
</div>
<div class='col-md-10 white-splash'>
<div class='maincontent'>
<?php
$mySearch = new WP_Query("s=$s & showposts=-1");
$NumResults = $mySearch->post_count;
if($NumResults == 1){
$r = __('result','ph_theme');
}else{
$r = __('results','ph_theme');
}
?>
<div class='options discuss-switch search-ph'><h1 class='search-heading'>
<?php
echo __('Results for ','ph_theme') . '<span class="search-query">'. $s . '</span><span class="nr"> ' . $NumResults . ' ' . $r . '</span></h1></div>';
global $wp_query,$post,$wpdb, $current_user,$query_string;
wp_get_current_user();
$wpdb->myo_ip = $wpdb->prefix . 'epicred';
$args = get_query_var('latest');
$posttype = get_query_var('post_type');
$day_check = '';
$num_posts = 0;
if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post();
$num_posts++;
?>
<?php if($post->post_type == 'product'){
echo '<div class="woocommerce">';
// wc_get_template_part( 'content', 'product' );
echo "</div>";
}else{
$postvote = get_post_meta($post->ID, 'epicredvote' ,true);
wpeddit_post_ranking($post->ID);
if($postvote == NULL){
$postvote = 0;
}
$fid = $current_user->ID;
$query = "SELECT epicred_option FROM $wpdb->myo_ip WHERE epicred_ip = $fid AND epicred_id = $post->ID";
$al = $wpdb->get_var($query);
if($al == NULL){
$al = 0;
$redclassu = 'up';
$redscore = "unvoted";
$c = "none";
}else if($al==1){
$redclassu = 'upmod';
$redclassd = 'down';
$redscore = 'likes';
$voted = 'yesvote';
$c = 'blue';
}else{
$redclassu = 'upmod';
$redclassd = 'down';
$redscore = 'likes';
}
if($num_posts > 10 && $paged > 1){
$blob = 'hidepost hidepost-' . $d . '-'. $m. '-' . $y;
}else{
$blob = '';
}
if( get_theme_mod( 'pluginhunt_post_layout' ) == 'option2'){
$span = 'col-md-3';
}
?>
<div class = 'row hunt-row <?php echo $blob;?>'>
<?php
$plugina = get_post_meta($post->ID,'pluginauthor', true);
if($plugina ==''){
$pname = get_the_author_meta('user_nicename');
$auth = 'yes';
}else{
$pname = $plugina;
$auth = 'no';
}
$profileUrl = '#'; if (isset($post->ID)) $profileUrl = get_author_posts_url($post->post_author);
$url = home_url();
if(wp_is_mobile()){
$mob = '-mob';
}
$out = get_post_meta($post->ID, 'outbound', true);
$n = parse_url($out);
$phfi = get_post_meta($post->ID,'phfeaturedimage',true);
?>
<?php if ( has_post_thumbnail() ) { ?>
<div class = 'reddit-post pull-left' id='reddit-post-<?php echo $post->ID;?>' data-ph-url="<?php echo get_permalink( $post->ID ); ?>" data-slug='<?php echo $post->post_name; ?>' data-id='<?php echo $post->ID; ?>' data-url = '<?php echo $url; ?>' data-auth = '<?php echo $auth; ?>' data-rajax = '<?php echo $post->ID; ?>' data-rups = '<?php echo $postvote;?>' data-pname='<?php echo $pname;?>' data-profurl="<?php echo $profileUrl; ?>" data-red-current = <?php echo $al;?> data-red-like = "<?php echo $redclassd; ?>">
<div class='ph-list-thumbnail'>
<?php the_post_thumbnail('small'); ?>
</div>
<?php }elseif($phfi != ''){ ?>
<div class = 'reddit-post pull-left' id='reddit-post-<?php echo $post->ID;?>' data-ph-url="<?php echo get_permalink( $post->ID ); ?>" data-slug='<?php echo $post->post_name; ?>' data-id='<?php echo $post->ID; ?>' data-url = '<?php echo $url; ?>' data-auth = '<?php echo $auth; ?>' data-rajax = '<?php echo $post->ID; ?>' data-rups = '<?php echo $postvote;?>' data-pname='<?php echo $pname;?>' data-profurl="<?php echo $profileUrl; ?>" data-red-current = <?php echo $al;?> data-red-like = "<?php echo $redclassd; ?>">
<div class='ph-list-thumbnail'>
<img src="<?php echo $phfi;?>" class="attachment-small size-small wp-post-image">
</div>
<?php }else{ ?>
<div class = 'reddit-post pull-left' id='reddit-post-<?php echo $post->ID;?>' data-ph-url="<?php echo get_permalink( $post->ID ); ?>" data-slug='<?php echo $post->post_name; ?>' data-id='<?php echo $post->ID; ?>' data-url = '<?php echo $url; ?>' data-auth = '<?php echo $auth; ?>' data-rajax = '<?php echo $post->ID; ?>' data-rups = '<?php echo $postvote;?>' data-pname='<?php echo $pname;?>' data-profurl="<?php echo $profileUrl; ?>" data-red-current = <?php echo $al;?> data-red-like = "<?php echo $redclassd; ?>">
<?php } ?>
<div class='ph-content-detail'>
<div class='author-ava hide'>
<?php
if($plugina == ''){ ?>
<span class='author-tool' data-toggle="tooltip" data-placement="left" title="<?php echo get_the_author_meta('user_nicename'); ?>"> <?php
$args = array( 'class' => 'img-rounded');
echo get_avatar($post->post_author, 40, $args); ?></span>
<?php }else{
$pluginava = get_post_meta($post->ID,'pluginavatar',true);
?>
<span class='author-tool' data-toggle="tooltip" data-placement="left" title="<?php echo $plugina; ?>"><img class='img-rounded' src="<?php echo $pluginava;?>" height = "40px" width="40px"/></span>
<?php } ?>
</div>
<?php
//trim the title to 37 characters...
$title = get_the_title($post->ID);
if(strlen($title)>37){
// $title = substr( $title, 0, 37) . "...";
} ?>
<?php // if ( wp_is_mobile() ) { echo "<a href='". get_permalink( $post->ID ) ."'>"; } ?>
<div class='post-info'>
<span class='title'><?php echo $title; ?></span>
<?php // if ( wp_is_mobile() ) { echo '</a>'; } ?>
<div class='description'>
<?php
if( of_get_option('ph_grid_on') == 1) {
echo wp_trim_words( get_the_excerpt(), 10);
}else{
echo wp_trim_words( get_the_excerpt(), 20);
}
?>
<div class='low-blow'>
<div class = "reddit-voting <?php echo $c; ?> reddit-voting-<?php echo $post->ID; ?>">
<div class="arrow fa fa-caret-up fa-2x arrow-up-<?php echo $post->ID;?>" data-red-current = <?php echo $al;?> data-red-like = "<?php echo $redclassd; ?>" data-red-id = "<?php echo $post->ID;?>" role="button" aria-label="upvote" tabindex="0"></div>
<div class="score score-<?php echo $post->ID;?>" data-red-current = <?php echo $al;?>><?php echo $postvote; ?></div>
</div>
<div class='comment-icon'>
<span><svg width="12" height="11" viewBox="0 0 19 17" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="b"><stop stop-color="#CCC" offset="0%"></stop><stop stop-color="#BABABA" offset="100%"></stop></linearGradient><filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="a"><feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset><feGaussianBlur stdDeviation=".5" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.070000001 0" in="shadowBlurOuter1" result="shadowMatrixOuter1"></feColorMatrix><feMerge><feMergeNode in="shadowMatrixOuter1"></feMergeNode><feMergeNode in="SourceGraphic"></feMergeNode></feMerge></filter></defs><path d="M1.753 18.06C.66 16.996 0 15.623 0 14.125 0 10.742 3.358 8 7.5 8c4.142 0 7.5 2.742 7.5 6.125s-3.358 6.125-7.5 6.125c-1.03 0-2.01-.17-2.904-.476-1.46.845-4.318 1.962-4.318 1.962s.955-2.298 1.475-3.676z" transform="translate(2 -7)" filter="url(#a)" stroke="url(#b)" fill="#bbb" fill-rule="evenodd"></path></svg></span>
<span class='hunt-comm-count'><?php $comments = get_comments('post_id=' . $post->ID); echo count($comments); ?></span>
</div>
<div class='post-meta-hunt'>
<!-- external URL button -->
<div class='ph-external ph-action'>
<span class="post-item--action v-icon"><a href="<?php echo esc_url($out); ?>" target="_blank" data-reactid=".3.0.0:$1.0.2.0.$31121.0.0.3.0.0"><span data-reactid=".3.0.0:$1.0.2.0.$31121.0.0.3.0.0.0"><svg width="12" height="11" viewBox="0 0 16 14" xmlns="http://www.w3.org/2000/svg"><g fill="#BBB" fill-rule="evenodd"><path d="M0 3h16v2H0z"></path><rect width="16" height="2" rx="2"></rect><rect y="12" width="16" height="2" rx="2"></rect><rect width="2" height="14" rx="2"></rect><rect x="14" width="2" height="14" rx="2"></rect><path d="M9.355 6.355C9.16 6.16 9.215 6 9.49 6h3.26c.138 0 .25.115.25.25v3.26c0 .27-.152.338-.355.135l-3.29-3.29z"></path></g></svg></span></a></span>
</div>
<?php if(!ph_in_user_collection($post->ID)) { ?>
<div class='ph-collect ph-action' data-pid ='<?php echo $post->ID;?>'>
<span class="collect-button--icon" data-pid ='<?php echo $post->ID;?>'>
<svg width="12" height="11" viewBox="0 0 15 14" xmlns="http://www.w3.org/2000/svg">
<path d="M13 10V8.99c0-.54-.448-.99-1-.99-.556 0-1 .444-1 .99V10H9.99c-.54 0-.99.448-.99 1 0 .556.444 1 .99 1H11v1.01c0 .54.448.99 1 .99.556 0 1-.444 1-.99V12h1.01c.54 0 .99-.448.99-1 0-.556-.444-1-.99-1H13zM0 1c0-.552.447-1 .998-1h11.004c.55 0 .998.444.998 1 0 .552-.447 1-.998 1H.998C.448 2 0 1.556 0 1zm0 5c0-.552.447-1 .998-1h11.004c.55 0 .998.444.998 1 0 .552-.447 1-.998 1H.998C.448 7 0 6.556 0 6zm0 5c0-.552.453-1 .997-1h6.006c.55 0 .997.444.997 1 0 .552-.453 1-.997 1H.997C.447 12 0 11.556 0 11z" fill="#C8C0B1" fill-rule="evenodd"></path>
</svg>
<?php }else{ ?>
<div class='ph-collect in ph-action' data-pid ='<?php echo $post->ID;?>'>
<span class="collect-button--icon in" data-pid ='<?php echo $post->ID;?>'>
<svg width="12" height="11" viewBox="0 0 17 14" xmlns="http://www.w3.org/2000/svg">
<path d="M11.036 10.864L9.62 9.45c-.392-.394-1.022-.39-1.413 0-.393.393-.39 1.023 0 1.414l2.122 2.12c.193.198.45.295.703.295.256 0 .51-.1.706-.295l4.246-4.246c.385-.385.39-1.02-.002-1.413-.393-.393-1.022-.39-1.412-.002l-3.537 3.538zM0 1c0-.552.447-1 1-1h11c.553 0 1 .444 1 1 0 .552-.447 1-1 1H1c-.553 0-1-.444-1-1zm0 5c0-.552.447-1 1-1h11c.553 0 1 .444 1 1 0 .552-.447 1-1 1H1c-.553 0-1-.444-1-1zm0 5c0-.552.447-1 1-1h4.5c.552 0 1 .444 1 1 0 .552-.447 1-1 1H1c-.552 0-1-.444-1-1z" fill="#DC5425" fill-rule="evenodd"></path>
</svg>
<?php } ?>
<span class='ph-save'><?php _e('Save','pluginhunt'); ?></span>
</span>
</div>
</div>
<div style="clear:both"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<?php endwhile; ?>
<?php else : ?>
<div id="epic_page_end_2"><?php _e('No more','pluginhunt'); ?> <?php echo of_get_option('ph_hunt_plural');?>...</div>
<?php endif; ?>
<?php if($num_posts > 10 && $paged >1){
$more = $num_posts - 10;
echo "<div class='unhide show-hidden-posts'><span class='showmore' data-d=$d data-m=$m data-y=$y><i class='hp fa fa-chevron-down'></i> ";
$text = sprintf( _n( 'Show 1 more ' . of_get_option('ph_hunt_single'), 'Show %s more ' . of_get_option('ph_hunt_plural'), $more, 'pluginhunt' ), $more );
echo $text;
echo "</span></div>";
} ?>
<div class='container'>
<div id='navigation'>
<div class='next-posts-link'>
<a href="<?php echo esc_url( home_url( '/' ) )?>?day=<?php echo $d;?>&month=<?php echo $m;?>&year=<?php echo $y;?>">next</a>
</div>
</div>
</div>
<div id="results"></div>
<div id = "error"></div>
<div class='hide'>
<?php wp_link_pages(); ?>
</div>
</div>
</div>
</div>
<div class='col-md-3 discussion-collections wp-hide' style="margin-top:52px;display:none;"">
<?php if(!is_user_logged_in()){ ?>
<div class='sign-up-cta'>
<h3 class='section--heading'><?php echo of_get_option('ph_logged_out_tit'); ?></h3>
<h4><?php echo of_get_option('ph_logged_out_sub'); ?></h4>
<div class='ph_socials'>
<div class='ph-join'>
<div class='ph-soc-block'>
<ul class='ps-main'>
<li class='tw ph-sm'><a href="<?php echo wp_login_url(); ?>?loginTwitter=1&redirect=<?php echo $surl;?>" onclick="window.location = '<?php echo wp_login_url(); ?>?loginTwitter=1&redirect='+window.location.href; return false;">
<i class="fa fa-twitter"></i><?php _e('Log in to vote','pluginhunt'); ?></a></li>
<br/><li class='fb ph-sm'><a href="<?php echo wp_login_url(); ?>?loginFacebook=1&redirect=<?php echo $surl;?>" onclick="window.location = '<?php echo wp_login_url(); ?>?loginFacebook=1&redirect='+window.location.href; return false;">
<i class="fa fa-facebook"></i><?php _e('Log in to vote','pluginhunt'); ?></a></li>
</ul>
</div>
</div>
</div>
<div style="clear:both"></div>
</div> <!-- end sign up CTA -->
<?php } ?>
<?php get_sidebar('right') ?>
</div>
</div>
</div>
<?php wp_reset_query(); ?>
</div>
</div>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<?php get_footer(); ?>