-
Notifications
You must be signed in to change notification settings - Fork 0
/
single_full.php
173 lines (119 loc) · 4.67 KB
/
single_full.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
<?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-main-head container">
<div class='ph-search'>
<?php get_search_form(); ?>
</div>
</div>
<div class='container'>
<div class='row'>
<div class='col-md-8 maincontent toppad'>
<?php
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');
if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post();
$day = get_the_date('j');
$date = get_the_date('l');
$stamp = get_the_date('U');
if ($stamp >= strtotime("today"))
$date = __("Today",'ph_theme');
else if ($stamp >= strtotime("yesterday"))
$date = __('Yesterday','ph_theme');
if ($day != $day_check) {
if ($day_check != '') {
}
echo "<div class='timing'><span class='day'>". $date ."</span><span class='date'>" . get_the_date() . "</span></div>";
$day_check = $day;
}
?>
<?php if(is_page()){
}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;
}
if($al == 1){
$redclassu = 'upmod';
$redclassd = 'down';
$redscore = 'likes';
$voted = 'yesvote';
}elseif($al == -1){
$redclassd = 'downmod';
$redclassu = 'up';
$redscore = "dislikes";
$voted = "yesvote";
}else{
$redclassu = "up";
$redclassd = "down";
$redscore = "unvoted";
$voted = "novote";
}
?>
<div class = 'row hunt-row' style = 'margin-bottom:20px'>
<div class = 'reddit-voting'>
<ul class="unstyled">
<div class="arrow fa fa-caret-up fa-2x <?php echo $redclassu;?> arrow-up-<?php echo $post->ID;?>" data-red-current = <?php echo $al;?> data-red-like = "up" data-red-id = "<?php echo $post->ID;?>" role="button" aria-label="upvote" tabindex="0"></div>
<div class="score <?php echo $redscore;?> score-<?php echo $post->ID;?>" data-red-current = <?php echo $al;?>><?php echo $postvote; ?></div>
</ul>
</div>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
<?php if ( has_post_thumbnail() ) { ?>
<?php }else{ ?>
<?php } ?>
<div class = 'reddit-post pull-left' id='reddit-post-<?php echo $post->ID;?>' data-rajax = '<?php echo $post->ID; ?>' data-rups = '<?php echo $postvote;?>'>
<div class='post-meta-hunt'>
<div class='author-ava'>
<span class='author-tool' data-toggle="tooltip" data-placement="left" title="<?php echo get_the_author_meta('user_nicename'); ?>"> <?php echo get_avatar( get_the_author_meta( 'ID' ), 40 ); ?></span>
</div>
<div class='comment-icon'>
<i class="fa fa-comment"></i> <span='hunt-comm-count'><?php $comments = get_comments('post_id=' . $post->ID); echo count($comments); ?></span>
</div>
</div>
<?php if($post->post_type == 'post'){
$out = get_post_meta($post->ID, 'outbound', true);
$n = parse_url($out);
?>
<a class='title' href="<?php echo esc_url($out); ?>" title="<?php the_title_attribute(); ?>" target="_blank" rel="nofollow"><?php the_title(); ?></a>
<?php }else{ ?>
<a class='title'href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" target="_blank"><?php the_title(); ?></a>
<?php } ?>
<span class='description-single'><?php the_content(); ?></span>
</div>
<div style="clear:both"></div>
<div class = 'span8'>
<?php comments_template(); ?>
</div>
</div>
<?php } ?>
<?php endwhile; ?>
<?php else: ?>
<p><?php _e('Sorry, no posts matched your criteria.', 'ph_theme'); ?></p>
<?php endif; ?>
<div class='next-posts-link'>
<?php echo get_next_posts_link('More Posts','ph_theme'); ?>
</div>
<?php wp_reset_query(); ?>
<?php get_footer(); ?>