| @@ -13,8 +13,9 @@ | ||
| 13 | 13 | |
| 14 | 14 | return array( |
| 15 | 15 | 'blockId' => '', |
| 16 | 16 | 'previewImg' => '', |
| 17 | + 'infiniteScroll' => false, | |
| 17 | 18 | |
| 18 | 19 | /* |
| 19 | 20 | ============================ |
| 20 | 21 | General Setting |
| @@ -235,9 +236,9 @@ | ||
| 235 | 236 | |
| 236 | 237 | public function content( $attr, $noAjax ) { |
| 237 | 238 | $attr = wp_parse_args( $attr, $this->get_attributes() ); |
| 238 | 239 | $attr['queryUnique'] = isset( $attr['queryUnique'] ) ? $attr['queryUnique'] : ''; |
| 239 | - global $unique_ID; | |
| 240 | + global $ultp_unique_ID; | |
| 240 | 241 | |
| 241 | 242 | if ( ! $noAjax ) { |
| 242 | 243 | $paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' ); |
| 243 | 244 | $attr['paged'] = $paged ? $paged : 1; |
| @@ -242,9 +243,9 @@ | ||
| 242 | 243 | $paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' ); |
| 243 | 244 | $attr['paged'] = $paged ? $paged : 1; |
| 244 | 245 | } |
| 245 | 246 | if ( $attr['queryUnique'] && isset( $attr['savedQueryUnique'] ) ) { |
| 246 | - $unique_ID = $attr['savedQueryUnique']; | |
| 247 | + $ultp_unique_ID = $attr['savedQueryUnique']; | |
| 247 | 248 | } |
| 248 | 249 | $block_name = 'post-list-1'; |
| 249 | 250 | $wraper_before = $wraper_after = $post_loop = ''; |
| 250 | 251 | $attr['queryNumber'] = ultimate_post()->get_post_number( 6, $attr['queryNumber'], $attr['queryNumPosts'] ); |
| @@ -259,9 +260,9 @@ | ||
| 259 | 260 | $curr_post_id = get_the_ID(); |
| 260 | 261 | } |
| 261 | 262 | // Loadmore and Unique content |
| 262 | 263 | if ( $attr['queryUnique'] && isset( $attr['loadMoreQueryUnique'] ) && $attr['paginationShow'] && ( $attr['paginationType'] == 'loadMore' ) ) { |
| 263 | - $unique_ID = $attr['loadMoreQueryUnique']; | |
| 264 | + $ultp_unique_ID = $attr['loadMoreQueryUnique']; | |
| 264 | 265 | $current_unique_posts = $attr['ultp_current_unique_posts']; |
| 265 | 266 | } |
| 266 | 267 | |
| 267 | 268 | $attr['className'] = isset( $attr['className'] ) && $attr['className'] ? preg_replace( '/[^A-Za-z0-9_ -]/', '', $attr['className'] ) : ''; |
| @@ -275,16 +276,21 @@ | ||
| 275 | 276 | $attr['popupAutoPlay'] = $attr['popupAutoPlay'] == true; |
| 276 | 277 | $attr['readMoreText'] = wp_kses( $attr['readMoreText'], ultimate_post()->ultp_allowed_html_tags() ); |
| 277 | 278 | $attr['gridStyle'] = sanitize_html_class( $attr['gridStyle'] ); |
| 278 | 279 | |
| 280 | + $iscroll = ''; | |
| 281 | + $wrap_data = ''; | |
| 282 | + if ( $attr['infiniteScroll'] ) { | |
| 283 | + $iscroll = 'ultp-iscroll-active'; | |
| 284 | + include ULTP_PATH . 'blocks/template/infinite_scroll_data.php'; | |
| 285 | + } | |
| 286 | + | |
| 279 | 287 | if ( $recent_posts->have_posts() ) { |
| 280 | - | |
| 281 | 288 | // Pagination Block Html |
| 282 | 289 | include ULTP_PATH . 'blocks/template/pagination_block.php'; |
| 290 | + $wraper_before .= '<div ' . ( $attr['advanceId'] ? 'id="' . $attr['advanceId'] . '" ' : '' ) . ' class="ultp-post-grid-block wp-block-ultimate-post-' . $block_name . ' ultp-block-' . $attr['blockId'] . '' . ( $attr['align'] ? ' align' . $attr['align'] : '' ) . '' . ( $attr['className'] ? ' ' . $attr['className'] : '' ) . ' ' . $iscroll . ' ">'; | |
| 291 | + $wraper_before .= '<div class="ultp-block-wrapper" ' . $wrap_data . '>'; | |
| 283 | 292 | |
| 284 | - $wraper_before .= '<div ' . ( $attr['advanceId'] ? 'id="' . $attr['advanceId'] . '" ' : '' ) . ' class="ultp-post-grid-block wp-block-ultimate-post-' . $block_name . ' ultp-block-' . $attr['blockId'] . '' . ( $attr['align'] ? ' align' . $attr['align'] : '' ) . '' . ( $attr['className'] ? ' ' . $attr['className'] : '' ) . '">'; | |
| 285 | - $wraper_before .= '<div class="ultp-block-wrapper">'; | |
| 286 | - | |
| 287 | 293 | // Loading |
| 288 | 294 | $wraper_before .= ultimate_post()->postx_loading(); |
| 289 | 295 | if ( $attr['headingShow'] || $attr['filterShow'] || $attr['paginationShow'] ) { |
| 290 | 296 | $wraper_before .= '<div class="ultp-heading-filter">'; |
| @@ -328,9 +334,9 @@ | ||
| 328 | 334 | |
| 329 | 335 | include ULTP_PATH . 'blocks/template/category.php'; |
| 330 | 336 | |
| 331 | 337 | if ( $attr['queryUnique'] ) { |
| 332 | - $unique_ID[ $attr['queryUnique'] ][] = $post_id; | |
| 338 | + $ultp_unique_ID[ $attr['queryUnique'] ][] = $post_id; | |
| 333 | 339 | $current_unique_posts[] = $post_id; |
| 334 | 340 | } |
| 335 | 341 | |
| 336 | 342 | $post_loop .= '<' . $attr['contentTag'] . ' class="ultp-block-item post-id-' . $post_id . '">'; |
| @@ -463,9 +469,9 @@ | ||
| 463 | 469 | ++$idx; |
| 464 | 470 | ++$index; |
| 465 | 471 | endwhile; |
| 466 | 472 | if ( $attr['queryUnique'] ) { |
| 467 | - $post_loop .= "<span style='display: none;' class='ultp-current-unique-posts' data-ultp-unique-ids= " . wp_json_encode( $unique_ID ) . ' data-current-unique-posts= ' . wp_json_encode( $current_unique_posts ) . '> </span>'; | |
| 473 | + $post_loop .= "<span style='display: none;' class='ultp-current-unique-posts' data-ultp-unique-ids= " . wp_json_encode( $ultp_unique_ID ) . ' data-current-unique-posts= ' . wp_json_encode( $current_unique_posts ) . '> </span>'; | |
| 468 | 474 | } |
| 469 | 475 | // if ( ($attr['paginationShow'] || $attr['advPaginationEnable'] ) && ($attr['paginationType'] == 'loadMore')) { |
| 470 | 476 | // $wraper_after .= '<span class="ultp-loadmore-insert-before"></span>'; |
| 471 | 477 | // } |
| @@ -489,9 +495,9 @@ | ||
| 489 | 495 | $wraper_after .= '</div>'; |
| 490 | 496 | $wraper_after .= $pagi_block_html; |
| 491 | 497 | $wraper_after .= '</div>'; |
| 492 | 498 | |
| 493 | - wp_reset_query(); | |
| 499 | + wp_reset_postdata(); | |
| 494 | 500 | } else { |
| 495 | 501 | $wraper_before .= ultimate_post()->get_no_result_found_html( $attr['notFoundMessage'] ); |
| 496 | 502 | } |
| 497 | 503 | |