| @@ -18,8 +18,9 @@ | ||
| 18 | 18 | 'advFilterEnable' => false, |
| 19 | 19 | 'advPaginationEnable' => false, |
| 20 | 20 | 'defQueryTax' => array(), |
| 21 | 21 | 'advRelation' => 'AND', |
| 22 | + 'infiniteScroll' => false, | |
| 22 | 23 | |
| 23 | 24 | // -------------------------- |
| 24 | 25 | // Layout |
| 25 | 26 | // -------------------------- |
| @@ -216,9 +217,9 @@ | ||
| 216 | 217 | } |
| 217 | 218 | |
| 218 | 219 | public function content( $attr, $noAjax ) { |
| 219 | 220 | $attr = wp_parse_args( $attr, $this->get_attributes() ); |
| 220 | - global $unique_ID; | |
| 221 | + global $ultp_unique_ID; | |
| 221 | 222 | |
| 222 | 223 | if ( ! $noAjax ) { |
| 223 | 224 | $paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' ); |
| 224 | 225 | $attr['paged'] = $paged ? $paged : 1; |
| @@ -223,9 +224,9 @@ | ||
| 223 | 224 | $paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' ); |
| 224 | 225 | $attr['paged'] = $paged ? $paged : 1; |
| 225 | 226 | } |
| 226 | 227 | if ( $attr['queryUnique'] && isset( $attr['savedQueryUnique'] ) ) { |
| 227 | - $unique_ID = $attr['savedQueryUnique']; | |
| 228 | + $ultp_unique_ID = $attr['savedQueryUnique']; | |
| 228 | 229 | } |
| 229 | 230 | |
| 230 | 231 | $block_name = 'post-grid-3'; |
| 231 | 232 | $vid_icon_redirect = true; // Its used for video icon do not remove it |
| @@ -237,9 +238,9 @@ | ||
| 237 | 238 | $dummy_url = ULTP_URL . 'assets/img/ultp-fallback-img.png'; |
| 238 | 239 | |
| 239 | 240 | // Loadmore and Unique content |
| 240 | 241 | if ( $attr['queryUnique'] && isset( $attr['loadMoreQueryUnique'] ) && $attr['paginationShow'] && ( $attr['paginationType'] == 'loadMore' ) ) { |
| 241 | - $unique_ID = $attr['loadMoreQueryUnique']; | |
| 242 | + $ultp_unique_ID = $attr['loadMoreQueryUnique']; | |
| 242 | 243 | $current_unique_posts = $attr['ultp_current_unique_posts']; |
| 243 | 244 | } |
| 244 | 245 | |
| 245 | 246 | $attr['className'] = isset( $attr['className'] ) && $attr['className'] ? preg_replace( '/[^A-Za-z0-9_ -]/', '', $attr['className'] ) : ''; |
| @@ -255,15 +256,22 @@ | ||
| 255 | 256 | $attr['readMoreText'] = wp_kses( $attr['readMoreText'], ultimate_post()->ultp_allowed_html_tags() ); |
| 256 | 257 | $attr['titleAnimation'] = sanitize_html_class( $attr['titleAnimation'] ); |
| 257 | 258 | $attr['overlayContentPosition'] = sanitize_html_class( $attr['overlayContentPosition'] ); |
| 258 | 259 | |
| 260 | + $iscroll = ''; | |
| 261 | + $wrap_data = ''; | |
| 262 | + if ( $attr['infiniteScroll'] ) { | |
| 263 | + $iscroll = 'ultp-iscroll-active'; | |
| 264 | + include ULTP_PATH . 'blocks/template/infinite_scroll_data.php'; | |
| 265 | + } | |
| 266 | + | |
| 259 | 267 | if ( $recent_posts->have_posts() ) { |
| 260 | 268 | |
| 261 | 269 | // Pagination Block Html |
| 262 | 270 | include ULTP_PATH . 'blocks/template/pagination_block.php'; |
| 263 | 271 | |
| 264 | - $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'] : '' ) . '">'; | |
| 265 | - $wraper_before .= '<div class="ultp-block-wrapper">'; | |
| 272 | + $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 . '">'; | |
| 273 | + $wraper_before .= '<div class="ultp-block-wrapper" ' . $wrap_data . '>'; | |
| 266 | 274 | |
| 267 | 275 | // Loading |
| 268 | 276 | $wraper_before .= ultimate_post()->postx_loading(); |
| 269 | 277 | |
| @@ -308,9 +316,9 @@ | ||
| 308 | 316 | |
| 309 | 317 | include ULTP_PATH . 'blocks/template/category.php'; |
| 310 | 318 | |
| 311 | 319 | if ( $attr['queryUnique'] ) { |
| 312 | - $unique_ID[ $attr['queryUnique'] ][] = $post_id; | |
| 320 | + $ultp_unique_ID[ $attr['queryUnique'] ][] = $post_id; | |
| 313 | 321 | $current_unique_posts[] = $post_id; |
| 314 | 322 | } |
| 315 | 323 | |
| 316 | 324 | $post_loop .= '<' . $attr['contentTag'] . ' class="ultp-block-item post-id-' . $post_id . ( $attr['titleAnimation'] ? ' ultp-animation-' . $attr['titleAnimation'] : '' ) . '">'; |
| @@ -407,9 +415,9 @@ | ||
| 407 | 415 | $post_loop .= '</' . $attr['contentTag'] . '>'; |
| 408 | 416 | ++$idx; |
| 409 | 417 | endwhile; |
| 410 | 418 | if ( $attr['queryUnique'] ) { |
| 411 | - $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>'; | |
| 419 | + $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>'; | |
| 412 | 420 | } |
| 413 | 421 | // if ( ($attr['paginationShow'] || $attr['advPaginationEnable']) && ($attr['paginationType'] == 'loadMore')) { |
| 414 | 422 | // $wraper_after .= '<span class="ultp-loadmore-insert-before"></span>'; |
| 415 | 423 | // } |
| @@ -434,9 +442,9 @@ | ||
| 434 | 442 | $wraper_after .= '</div>'; |
| 435 | 443 | $wraper_after .= $pagi_block_html; |
| 436 | 444 | $wraper_after .= '</div>'; |
| 437 | 445 | |
| 438 | - wp_reset_query(); | |
| 446 | + wp_reset_postdata(); | |
| 439 | 447 | } else { |
| 440 | 448 | $wraper_before .= ultimate_post()->get_no_result_found_html( $attr['notFoundMessage'] ); |
| 441 | 449 | } |
| 442 | 450 | |