| @@ -15,8 +15,9 @@ | ||
| 15 | 15 | 'advFilterEnable' => false, |
| 16 | 16 | 'advPaginationEnable' => false, |
| 17 | 17 | 'defQueryTax' => array(), |
| 18 | 18 | 'advRelation' => 'AND', |
| 19 | + 'infiniteScroll' => false, | |
| 19 | 20 | /* |
| 20 | 21 | ============================ |
| 21 | 22 | Layout |
| 22 | 23 | ============================*/ |
| @@ -227,9 +228,9 @@ | ||
| 227 | 228 | } |
| 228 | 229 | |
| 229 | 230 | public function content( $attr, $noAjax ) { |
| 230 | 231 | $attr = wp_parse_args( $attr, $this->get_attributes() ); |
| 231 | - global $unique_ID; | |
| 232 | + global $ultp_unique_ID; | |
| 232 | 233 | |
| 233 | 234 | if ( ! $noAjax ) { |
| 234 | 235 | $paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' ); |
| 235 | 236 | $attr['paged'] = $paged ? $paged : 1; |
| @@ -234,9 +235,9 @@ | ||
| 234 | 235 | $paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' ); |
| 235 | 236 | $attr['paged'] = $paged ? $paged : 1; |
| 236 | 237 | } |
| 237 | 238 | if ( $attr['queryUnique'] && isset( $attr['savedQueryUnique'] ) ) { |
| 238 | - $unique_ID = $attr['savedQueryUnique']; | |
| 239 | + $ultp_unique_ID = $attr['savedQueryUnique']; | |
| 239 | 240 | } |
| 240 | 241 | $block_name = 'post-grid-1'; |
| 241 | 242 | $wraper_before = $wraper_after = $post_loop = ''; |
| 242 | 243 | $attr['queryNumber'] = ultimate_post()->get_post_number( 4, $attr['queryNumber'], $attr['queryNumPosts'] ); |
| @@ -255,9 +256,9 @@ | ||
| 255 | 256 | $dummy_url = ULTP_URL . 'assets/img/ultp-fallback-img.png'; |
| 256 | 257 | |
| 257 | 258 | // Loadmore and Unique content |
| 258 | 259 | if ( $attr['queryUnique'] && isset( $attr['loadMoreQueryUnique'] ) && $attr['paginationShow'] && ( $attr['paginationType'] == 'loadMore' ) ) { |
| 259 | - $unique_ID = $attr['loadMoreQueryUnique']; | |
| 260 | + $ultp_unique_ID = $attr['loadMoreQueryUnique']; | |
| 260 | 261 | $current_unique_posts = $attr['ultp_current_unique_posts']; |
| 261 | 262 | } |
| 262 | 263 | |
| 263 | 264 | $attr['className'] = isset( $attr['className'] ) && $attr['className'] ? preg_replace( '/[^A-Za-z0-9_ -]/', '', $attr['className'] ) : ''; |
| @@ -271,16 +272,21 @@ | ||
| 271 | 272 | $attr['imgOverlayType'] = sanitize_html_class( $attr['imgOverlayType'] ); |
| 272 | 273 | $attr['popupAutoPlay'] = $attr['popupAutoPlay'] == true; |
| 273 | 274 | $attr['readMoreText'] = wp_kses( $attr['readMoreText'], ultimate_post()->ultp_allowed_html_tags() ); |
| 274 | 275 | |
| 276 | + include ULTP_PATH . 'blocks/template/pagination_block.php'; | |
| 277 | + $iscroll = ''; | |
| 278 | + $wrap_data = ''; | |
| 279 | + if ( $attr['infiniteScroll'] ) { | |
| 280 | + $iscroll = 'ultp-iscroll-active'; | |
| 281 | + include ULTP_PATH . 'blocks/template/infinite_scroll_data.php'; | |
| 282 | + } | |
| 283 | + | |
| 275 | 284 | if ( $recent_posts->have_posts() ) { |
| 276 | - | |
| 277 | 285 | // Pagination Block Html |
| 278 | - include ULTP_PATH . 'blocks/template/pagination_block.php'; | |
| 286 | + $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 . ' ">'; | |
| 287 | + $wraper_before .= '<div class="ultp-block-wrapper" ' . $wrap_data . '>'; | |
| 279 | 288 | |
| 280 | - $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'] : '' ) . '">'; | |
| 281 | - $wraper_before .= '<div class="ultp-block-wrapper">'; | |
| 282 | - | |
| 283 | 289 | // Loading |
| 284 | 290 | $wraper_before .= ultimate_post()->postx_loading(); |
| 285 | 291 | |
| 286 | 292 | if ( $attr['headingShow'] || $attr['filterShow'] || $attr['paginationShow'] ) { |
| @@ -331,9 +337,9 @@ | ||
| 331 | 337 | |
| 332 | 338 | include ULTP_PATH . 'blocks/template/category.php'; |
| 333 | 339 | |
| 334 | 340 | if ( $attr['queryUnique'] ) { |
| 335 | - $unique_ID[ $attr['queryUnique'] ][] = $post_id; | |
| 341 | + $ultp_unique_ID[ $attr['queryUnique'] ][] = $post_id; | |
| 336 | 342 | $current_unique_posts[] = $post_id; |
| 337 | 343 | } |
| 338 | 344 | $divStyle = ''; |
| 339 | 345 | if ( $post_thumb_id && $attr['showImage'] ) { |
| @@ -437,9 +443,9 @@ | ||
| 437 | 443 | $post_loop .= '</' . $attr['contentTag'] . '>'; |
| 438 | 444 | ++$idx; |
| 439 | 445 | endwhile; |
| 440 | 446 | if ( $attr['queryUnique'] ) { |
| 441 | - $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>'; | |
| 447 | + $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>'; | |
| 442 | 448 | } |
| 443 | 449 | // if ( ($attr['paginationShow'] || $attr['advPaginationEnable']) && ($attr['paginationType'] == 'loadMore')) { |
| 444 | 450 | // $wraper_after .= '<span class="ultp-loadmore-insert-before"></span>'; |
| 445 | 451 | // } |
| @@ -463,9 +469,9 @@ | ||
| 463 | 469 | $wraper_after .= '</div>'; |
| 464 | 470 | $wraper_after .= $pagi_block_html; |
| 465 | 471 | $wraper_after .= '</div>'; |
| 466 | 472 | |
| 467 | - wp_reset_query(); | |
| 473 | + wp_reset_postdata(); | |
| 468 | 474 | |
| 469 | 475 | } else { |
| 470 | 476 | $wraper_before .= ultimate_post()->get_no_result_found_html( $attr['notFoundMessage'] ); |
| 471 | 477 | } |