PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.2.10
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.2.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
← All changes | public/template/loop/class-loop-html.php +53 -44 2.4.132.2.10 View file →
@@ -21,13 +21,13 @@
21 21
22 22 /**
23 23 * Section title
24 24 *
25 - * @param int $title shortcode title.
25 + * @param int $pcp_id Shortcode id.
26 26 * @return void
27 27 */
28 - public static function pcp_section_title( $title ) {
29 - $section_title_text = apply_filters( 'pcp_section_title_text', $title );
28 + public static function pcp_section_title( $pcp_id ) {
29 + $section_title_text = apply_filters( 'pcp_section_title_text', get_the_title( $pcp_id ) );
30 30 $section_title = apply_filters( 'pcp_filter_section_title', sprintf( '<h2 class="pcp-section-title">%1$s</h2>', $section_title_text ), $section_title_text );
31 31 echo wp_kses_post( $section_title );
32 32 }
33 33
@@ -35,9 +35,8 @@
35 35 * Post title html.
36 36 *
37 37 * @param array $sorter post content option array.
38 38 * @param string $layout layout preset.
39 - * @param array $options The options array.
40 39 * @return void
41 40 */
42 41 public static function pcp_post_title( $sorter, $layout, $options ) {
43 42
@@ -45,10 +44,13 @@
45 44 $post_meta_fields = SP_PC_Functions::pcp_metabox_value( 'pcp_post_meta_group', $_meta_settings );
46 45 $show_post_meta = SP_PC_Functions::pcp_metabox_value( 'show_post_meta', $_meta_settings, true );
47 46 $pcp_page_link_type = SP_PC_Functions::pcp_metabox_value( 'pcp_page_link_type', $options );
48 47 $pcp_link_rel = SP_PC_Functions::pcp_metabox_value( 'pcp_link_rel', $options );
49 - $pcp_link_rel_text = $pcp_link_rel ? 'rel="nofollow"' : '';
50 - $pcp_link_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options );
48 + $pcp_link_rel_text = '';
49 + if ( $pcp_link_rel ) {
50 + $pcp_link_rel_text = "rel='nofollow'";
51 + }
52 + $pcp_link_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options );
51 53 if ( is_array( $post_meta_fields ) && 'accordion_layout' !== $layout && $show_post_meta ) {
52 54 foreach ( $post_meta_fields as $each_meta ) {
53 55 if ( 'taxonomy' === $each_meta['select_post_meta'] ) {
54 56 $taxonomy = $each_meta['post_meta_taxonomy'];
@@ -56,13 +58,13 @@
56 58 if ( 'above_title' === $meta_position ) {
57 59 $terms = get_the_term_list( get_the_ID(), $taxonomy, '', ' ' );
58 60 if ( $terms ) {
59 61 ?>
60 - <div class="pcp-category above_title <?php echo esc_attr( $taxonomy ); ?>">
61 - <?php echo wp_kses_post( $terms ); ?>
62 + <div class="pcp-category above_title <?php echo $taxonomy; ?>">
63 + <?php echo $terms; ?>
62 64 </div>
63 65 <?php
64 - }
66 + };
65 67 }
66 68 }
67 69 }
68 70 }
@@ -78,9 +80,8 @@
78 80 $allowed_html_tags = array(
79 81 'em' => array(),
80 82 'strong' => array(),
81 83 'sup' => array(),
82 - 'sub' => array(),
83 84 'i' => array(),
84 85 'small' => array(),
85 86 'del' => array(),
86 87 'br' => array(),
@@ -92,11 +93,11 @@
92 93 );
93 94 ?>
94 95 <<?php echo esc_attr( $post_title_tag ); ?> class="sp-pcp-title">
95 96 <?php if ( 'none' === $pcp_page_link_type ) { ?>
96 - <?php echo sprintf( '<a %2$s>%1$s</a>', wp_kses( trim( $pcp_post_title ), $allowed_html_tags ), wp_kses_post( $pcp_link_rel_text ) ); ?>
97 + <?php echo sprintf( '<a %2$s>%1$s</a>', wp_kses( trim( $pcp_post_title ), $allowed_html_tags ), esc_attr( $pcp_link_rel_text ) ); ?>
97 98 <?php } else { ?>
98 - <?php echo sprintf( '<a href="%1$s" %3$s target="%4$s">%2$s</a>', esc_url( get_the_permalink() ), wp_kses( trim( $pcp_post_title ), $allowed_html_tags ), wp_kses_post( $pcp_link_rel_text ), esc_attr( $pcp_link_target ) ); ?>
99 + <?php echo sprintf( '<a href="%1$s" %3$s target="%4$s">%2$s</a>', esc_url( get_the_permalink() ), wp_kses( trim( $pcp_post_title ), $allowed_html_tags ), esc_attr( $pcp_link_rel_text ), esc_attr( $pcp_link_target ) ); ?>
99 100 <?php } ?>
100 101 </<?php echo esc_attr( $post_title_tag ); ?>>
101 102 <?php
102 103 }
@@ -151,20 +152,23 @@
151 152 $show_read_more = isset( $view_options['show_read_more'] ) ? $view_options['show_read_more'] : '';
152 153 if ( ! $show_read_more || 'full_content' === $content_type ) {
153 154 return '';
154 155 }
155 -
156 + // $read_more_type = isset( $view_options['read_more_type'] ) ? $view_options['read_more_type'] : '';
156 157 $pcp_read_label = isset( $view_options['pcp_read_label'] ) ? $view_options['pcp_read_label'] : '';
157 158 $pcp_page_link_type = SP_PC_Functions::pcp_metabox_value( 'pcp_page_link_type', $options );
158 159 $pcp_link_rel = SP_PC_Functions::pcp_metabox_value( 'pcp_link_rel', $options );
159 - $pcp_link_rel_text = $pcp_link_rel ? 'rel="nofollow"' : '';
160 - $readmore_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options );
160 + $pcp_link_rel_text = '';
161 + if ( $pcp_link_rel ) {
162 + $pcp_link_rel_text = "rel='nofollow'";
163 + }
164 + $readmore_target = SP_PC_Functions::pcp_metabox_value( 'pcp_link_target', $options );
161 165 ?>
162 166 <div class="sp-pcp-readmore">
163 167 <?php if ( 'none' === $pcp_page_link_type ) { ?>
164 - <a class="pcp-readmore-link" target="<?php echo esc_attr( $readmore_target ); ?>" <?php echo wp_kses_post( $pcp_link_rel_text ); ?>>
168 + <a class="pcp-readmore-link" target="<?php echo esc_attr( $readmore_target ); ?>" <?php echo esc_html( $pcp_link_rel_text ); ?>>
165 169 <?php } else { ?>
166 - <a class="pcp-readmore-link" target="<?php echo esc_attr( $readmore_target ); ?>" href="<?php the_permalink(); ?>" <?php echo wp_kses_post( $pcp_link_rel_text ); ?>>
170 + <a class="pcp-readmore-link" target="<?php echo esc_attr( $readmore_target ); ?>" href="<?php the_permalink(); ?>" <?php echo esc_html( $pcp_link_rel_text ); ?>>
167 171 <?php } ?>
168 172 <?php echo esc_html( $pcp_read_label ); ?> </a>
169 173 </div>
170 174 <?php
@@ -213,8 +217,9 @@
213 217 /**
214 218 * Post meta HTML
215 219 *
216 220 * @param array $sorter post content option array.
221 + * @param int $visitor_count views count.
217 222 * @return void
218 223 */
219 224 public static function pcp_post_meta_html( $sorter ) {
220 225 $_meta_settings = SP_PC_Functions::pcp_metabox_value( 'pcp_post_meta', $sorter );
@@ -219,17 +224,16 @@
219 224 public static function pcp_post_meta_html( $sorter ) {
220 225 $_meta_settings = SP_PC_Functions::pcp_metabox_value( 'pcp_post_meta', $sorter );
221 226 $post_meta_fields = SP_PC_Functions::pcp_metabox_value( 'pcp_post_meta_group', $_meta_settings );
222 227 $show_post_meta = SP_PC_Functions::pcp_metabox_value( 'show_post_meta', $_meta_settings, true );
223 - $_meta_separator = ' ';
224 - // $_meta_separator = SP_PC_Functions::pcp_metabox_value( 'meta_separator', $_meta_settings );
228 + $_meta_separator = SP_PC_Functions::pcp_metabox_value( 'meta_separator', $_meta_settings );
225 229 if ( $post_meta_fields && $show_post_meta ) {
226 230 ?>
227 231 <div class="sp-pcp-post-meta">
228 232 <?php
229 - echo wp_kses_post( apply_filters( 'pcp_post_meta_wrapper_start', '<ul>' ) );
233 + echo apply_filters( 'pcp_post_meta_wrapper_start', '<ul>' );
230 234 SP_PC_Functions::pcp_get_post_meta( $post_meta_fields, $_meta_separator );
231 - echo wp_kses_post( apply_filters( 'pcp_post_meta_wrapper_end', '</ul>' ) );
235 + echo apply_filters( 'pcp_post_meta_wrapper_end', '</ul>' );
232 236 ?>
233 237 </div>
234 238 <?php
235 239 }
@@ -241,9 +245,8 @@
241 245 * @param array $sorter post sorting option.
242 246 * @param string $layout Layout preset.
243 247 * @param int $scode_id The Shortcode ID.
244 248 * @param object $post The Post object.
245 - * @param array $options The options array.
246 249 * @return void
247 250 */
248 251 public static function pcp_post_content_with_thumb( $sorter, $layout, $scode_id, $post, $options ) {
249 252 if ( $sorter ) {
@@ -271,9 +274,8 @@
271 274 *
272 275 * @param array $sorter post sorting option.
273 276 * @param string $layout Layout preset.
274 277 * @param object $post visitor number.
275 - * @param array $options The options array.
276 278 * @return void
277 279 */
278 280 public static function pcp_post_content_without_thumb( $sorter, $layout, $post, $options ) {
279 281 if ( $sorter ) {
@@ -295,14 +297,15 @@
295 297
296 298 /**
297 299 * Pagination function
298 300 *
299 - * @param object $loop Query array.
300 - * @param array $view_options shortcode options.
301 - * @param array $pcp_gl_id shortcode id.
302 - * @param array $on_screen screen type.
301 + * @param array $loop Query array.
302 + * @param array $upper_id Fields upper id.
303 + * @param array $paged The pagination type.
304 + * @param array $on_screen screen type.
303 305 */
304 - public static function pcp_pagination_bar( $loop, $view_options, $pcp_gl_id, $on_screen = null ) {
306 + public static function pcp_pagination_bar( $loop, $upper_id, $paged = null, $on_screen = null ) {
307 + $view_options = get_post_meta( $upper_id, 'sp_pcp_view_options', true );
305 308 // $posts_found;
306 309 $posts_found = $loop->found_posts;
307 310 $post_offset = isset( $view_options['pcp_post_offset'] ) ? $view_options['pcp_post_offset'] : 0;
308 311 $post_limit = isset( $view_options['pcp_post_limit'] ) ? $view_options['pcp_post_limit'] : '';
@@ -309,9 +312,9 @@
309 312 $post_limit = ( $post_limit > 0 && $posts_found > $post_limit ) ? $post_limit : $posts_found;
310 313 $post_per_page = isset( $view_options['post_per_page'] ) ? $view_options['post_per_page'] : '';
311 314 $post_per_page = ( $post_per_page > $post_limit ) ? $post_limit : $post_per_page;
312 315 // Post display settings.
313 - $post_limit = (int) $post_limit;
316 + $post_limit = (int) $post_limit;
314 317 if ( $post_limit < 1 ) {
315 318 $pages = 0;
316 319 } else {
317 320 $pages = SP_PC_Functions::pcp_max_pages( $post_limit, $post_per_page );
@@ -317,22 +320,28 @@
317 320 $pages = SP_PC_Functions::pcp_max_pages( $post_limit, $post_per_page );
318 321 }
319 322 $big = 999999999; // need an unlikely integer.
320 323 if ( $pages > 1 ) {
321 - $paged_var = 'paged' . $pcp_gl_id;
322 - $page_current = ( ! empty( $_GET[ "$paged_var" ] ) ) ? sanitize_text_field( wp_unslash( $_GET[ "$paged_var" ] ) ) : 1;
323 - $page_links = paginate_links(
324 - array(
325 - 'format' => '?' . $paged_var . '=%#%',
326 - 'current' => $page_current,
327 - 'total' => $pages,
328 - 'show_all' => true,
329 - 'prev_next' => true,
330 - 'type' => 'array',
331 - 'prev_text' => '<i class="fa fa-angle-left"></i>',
332 - 'next_text' => '<i class="fa fa-angle-right"></i>',
333 - )
334 - );
335 - echo wp_kses_post( implode( $page_links ) );
324 + if ( get_query_var( 'paged' ) ) {
325 + $page_current = max( 1, get_query_var( 'paged' ) );
326 + } elseif ( get_query_var( 'page' ) ) {
327 + $page_current = max( 1, get_query_var( 'page' ) );
328 + } else {
329 + $page_current = 1;
330 + }
331 + $page_links = paginate_links(
332 + array(
333 + 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
334 + 'format' => '?paged=%#%',
335 + 'current' => $page_current,
336 + 'total' => $pages,
337 + 'show_all' => true,
338 + 'prev_next' => true,
339 + 'type' => 'array',
340 + 'prev_text' => '<i class="fa fa-angle-left"></i>',
341 + 'next_text' => '<i class="fa fa-angle-right"></i>',
342 + )
343 + );
344 + echo implode( $page_links );
336 345 }
337 346 }
338 347 }