-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle.php
More file actions
255 lines (199 loc) · 8.17 KB
/
single.php
File metadata and controls
255 lines (199 loc) · 8.17 KB
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
<?php
/******************/
/** Single Post
/******************/
get_header();
?>
<section class="container page-content" >
<hr class="vertical-space2">
<?php
if( 'none' != $webnus_options->webnus_blog_singlepost_sidebar() )
if( 'left' == $webnus_options->webnus_blog_singlepost_sidebar() ){
get_sidebar('bleft');
}
?>
<section class="<?php echo ( 'none' == $webnus_options->webnus_blog_singlepost_sidebar() )?'col-md-12':'col-md-8'?> omega ">
<?php if( have_posts() ): while( have_posts() ): the_post(); ?>
<article class="blog-single-post">
<?php
setViews(get_the_ID());
GLOBAL $webnus_options;
$post_format = get_post_format(get_the_ID());
$content = get_the_content();
if( $webnus_options->webnus_blog_sinlge_featuredimage_enable() ){
global $featured_video;
$meta_video = $featured_video->the_meta();
if( 'video' == $post_format || 'audio' == $post_format)
{
$pattern =
'\\[' // Opening bracket
. '(\\[?)' // 1: Optional second opening bracket for escaping shortcodes: [[tag]]
. "(video|audio)" // 2: Shortcode name
. '(?![\\w-])' // Not followed by word character or hyphen
. '(' // 3: Unroll the loop: Inside the opening shortcode tag
. '[^\\]\\/]*' // Not a closing bracket or forward slash
. '(?:'
. '\\/(?!\\])' // A forward slash not followed by a closing bracket
. '[^\\]\\/]*' // Not a closing bracket or forward slash
. ')*?'
. ')'
. '(?:'
. '(\\/)' // 4: Self closing tag ...
. '\\]' // ... and closing bracket
. '|'
. '\\]' // Closing bracket
. '(?:'
. '(' // 5: Unroll the loop: Optionally, anything between the opening and closing shortcode tags
. '[^\\[]*+' // Not an opening bracket
. '(?:'
. '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag
. '[^\\[]*+' // Not an opening bracket
. ')*+'
. ')'
. '\\[\\/\\2\\]' // Closing shortcode tag
. ')?'
. ')'
. '(\\]?)';
preg_match('/'.$pattern.'/s', $post->post_content, $matches);
if( (is_array($matches)) && (isset($matches[3])) && ( ($matches[2] == 'video') || ('audio' == $post_format)) && (isset($matches[2])))
{
$video = $matches[0];
echo do_shortcode($video);
$content = preg_replace('/'.$pattern.'/s', '', $content);
}else
if( (!empty( $meta_video )) && (!empty($meta_video['the_post_video'])) )
{
echo do_shortcode($meta_video['the_post_video']);
}
}else
if( 'gallery' == $post_format)
{
$pattern =
'\\[' // Opening bracket
. '(\\[?)' // 1: Optional second opening bracket for escaping shortcodes: [[tag]]
. "(gallery)" // 2: Shortcode name
. '(?![\\w-])' // Not followed by word character or hyphen
. '(' // 3: Unroll the loop: Inside the opening shortcode tag
. '[^\\]\\/]*' // Not a closing bracket or forward slash
. '(?:'
. '\\/(?!\\])' // A forward slash not followed by a closing bracket
. '[^\\]\\/]*' // Not a closing bracket or forward slash
. ')*?'
. ')'
. '(?:'
. '(\\/)' // 4: Self closing tag ...
. '\\]' // ... and closing bracket
. '|'
. '\\]' // Closing bracket
. '(?:'
. '(' // 5: Unroll the loop: Optionally, anything between the opening and closing shortcode tags
. '[^\\[]*+' // Not an opening bracket
. '(?:'
. '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag
. '[^\\[]*+' // Not an opening bracket
. ')*+'
. ')'
. '\\[\\/\\2\\]' // Closing shortcode tag
. ')?'
. ')'
. '(\\]?)';
preg_match('/'.$pattern.'/s', $post->post_content, $matches);
if( (is_array($matches)) && (isset($matches[3])) && ($matches[2] == 'gallery') && (isset($matches[2])))
{
$atts = shortcode_parse_atts($matches[3]);
$ids = $gallery_type = '';
if(isset($atts['ids']))
{
$ids = $atts['ids'];
}
if(isset($atts['webnus_gallery_type']))
{
$gallery_type = $atts['webnus_gallery_type'];
}
echo do_shortcode('[vc_gallery img_size= "full" type="flexslider_fade" interval="3" images="'.$ids.'" onclick="link_image" custom_links_target="_self"]');
$content = preg_replace('/'.$pattern.'/s', '', $content);
}
}else
if( (!empty( $meta_video )) && (!empty($meta_video['the_post_video'])) )
{
echo do_shortcode($meta_video['the_post_video']);
}
else
get_the_image( array( 'meta_key' => array( 'Full', 'Full' ), 'size' => 'Full' ) );
}
?>
<?php
?>
<div <?php post_class('post'); ?>>
<div class="postmetadata">
<?php if( 1 == $webnus_options->webnus_blog_meta_gravatar_enable() ) { ?>
<div class="au-avatar"><?php echo get_avatar( get_the_author_meta( 'user_email' ), 90 ); ?></div>
<?php } ?>
<?php if( 1 == $webnus_options->webnus_blog_meta_author_enable() ) { ?>
<h6 class="blog-author"><strong><?php _e('by','WEBNUS_TEXT_DOMAIN'); ?></strong> <?php the_author(); ?> </h6>
<?php } ?>
<?php if( 1 == $webnus_options->webnus_blog_meta_category_enable() ) { ?>
<h6 class="blog-cat"><strong><?php _e('in','WEBNUS_TEXT_DOMAIN'); ?></strong> <?php the_category(', ') ?> </h6>
<?php } ?>
<?php if( 1 == $webnus_options->webnus_blog_meta_comments_enable() ) { ?>
<h6 class="blog-comments"> <?php comments_number( ); ?> </h6>
<?php } ?>
<?php if( 1 == $webnus_options->webnus_blog_meta_views_enable() ) { ?>
<h6 class="blog-views"> <i class="fa-eye"></i><span><?php echo getViews(get_the_ID()); ?></span> </h6>
<?php } ?>
</div>
<?php if( 1 == $webnus_options->webnus_blog_meta_date_enable() ) { ?>
<h6 class="blog-date"><span><?php the_time('d') ?> </span><?php the_time('M Y') ?> </h6>
<?php } ?>
<h1><?php the_title() ?></h1>
<?php
if( 'quote' == $post_format ) echo '<blockquote>';
echo apply_filters('the_content',$content);
if( 'quote' == $post_format ) echo '</blockquote>';
?>
<br class="clear">
<?php the_tags( '<div class="post-tags"><i class="fa-tags"></i>', '', '</div>' ); ?><!-- End Tags -->
<div class="next-prev-posts">
<?php $args = array(
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'next_or_number' => 'next',
'nextpagelink' => ' '.__('Next Page','WEBNUS_TEXT_DOMAIN'),
'previouspagelink' => __('Previous Page','WEBNUS_TEXT_DOMAIN').' ',
'pagelink' => '%',
'echo' => 1
);
wp_link_pages($args);
?>
</div><!-- End next-prev post -->
<?php if( $webnus_options->webnus_blog_single_authorbox_enable() ) { ?>
<div class="about-author-sec">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), 90 ); ?>
<h5><?php the_author(); ?></h5>
<p><?php echo get_the_author_meta( 'description' ); ?></p>
</div>
<?php } ?>
</div>
<?php
?>
</article>
<?php
endwhile;
endif;
comments_template(); ?>
</section>
<!-- end-main-conten -->
<?php
if( 'none' != $webnus_options->webnus_blog_singlepost_sidebar() )
if( 'right' == $webnus_options->webnus_blog_singlepost_sidebar() ){
get_sidebar('bright');
}
?>
<!-- end-sidebar-->
<div class="white-space"></div>
</section>
<?php
get_footer();
?>