| @@ -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 | // Query Setting |
| 24 | 25 | // -------------------------- |
| 25 | 26 | 'queryQuick' => '', |
| @@ -209,9 +210,9 @@ | ||
| 209 | 210 | } |
| 210 | 211 | |
| 211 | 212 | public function content( $attr, $noAjax ) { |
| 212 | 213 | $attr = wp_parse_args( $attr, $this->get_attributes() ); |
| 213 | - global $unique_ID; | |
| 214 | + global $ultp_unique_ID; | |
| 214 | 215 | |
| 215 | 216 | if ( ! $noAjax ) { |
| 216 | 217 | $paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' ); |
| 217 | 218 | $attr['paged'] = $paged ? $paged : 1; |
| @@ -216,9 +217,9 @@ | ||
| 216 | 217 | $paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' ); |
| 217 | 218 | $attr['paged'] = $paged ? $paged : 1; |
| 218 | 219 | } |
| 219 | 220 | if ( $attr['queryUnique'] && isset( $attr['savedQueryUnique'] ) ) { |
| 220 | - $unique_ID = $attr['savedQueryUnique']; | |
| 221 | + $ultp_unique_ID = $attr['savedQueryUnique']; | |
| 221 | 222 | } |
| 222 | 223 | |
| 223 | 224 | $block_name = 'post-grid-2'; |
| 224 | 225 | $wraper_before = $wraper_after = $post_loop = ''; |
| @@ -234,9 +235,9 @@ | ||
| 234 | 235 | $dummy_url = ULTP_URL . 'assets/img/ultp-fallback-img.png'; |
| 235 | 236 | |
| 236 | 237 | // Loadmore and Unique content |
| 237 | 238 | if ( $attr['queryUnique'] && isset( $attr['loadMoreQueryUnique'] ) && $attr['paginationShow'] && ( $attr['paginationType'] == 'loadMore' ) ) { |
| 238 | - $unique_ID = $attr['loadMoreQueryUnique']; | |
| 239 | + $ultp_unique_ID = $attr['loadMoreQueryUnique']; | |
| 239 | 240 | $current_unique_posts = $attr['ultp_current_unique_posts']; |
| 240 | 241 | } |
| 241 | 242 | |
| 242 | 243 | $attr['className'] = isset( $attr['className'] ) && $attr['className'] ? preg_replace( '/[^A-Za-z0-9_ -]/', '', $attr['className'] ) : ''; |
| @@ -250,15 +251,21 @@ | ||
| 250 | 251 | $attr['readMoreText'] = wp_kses( $attr['readMoreText'], ultimate_post()->ultp_allowed_html_tags() ); |
| 251 | 252 | $attr['titleAnimation'] = sanitize_html_class( $attr['titleAnimation'] ); |
| 252 | 253 | $attr['overlayContentPosition'] = sanitize_html_class( $attr['overlayContentPosition'] ); |
| 253 | 254 | |
| 255 | + $iscroll = ''; | |
| 256 | + $wrap_data = ''; | |
| 257 | + if ( $attr['infiniteScroll'] ) { | |
| 258 | + $iscroll = 'ultp-iscroll-active'; | |
| 259 | + include ULTP_PATH . 'blocks/template/infinite_scroll_data.php'; | |
| 260 | + } | |
| 261 | + | |
| 254 | 262 | if ( $recent_posts->have_posts() ) { |
| 255 | - | |
| 256 | 263 | // Pagination Block Html |
| 257 | 264 | include ULTP_PATH . 'blocks/template/pagination_block.php'; |
| 258 | 265 | |
| 259 | - $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'] : '' ) . '">'; | |
| 260 | - $wraper_before .= '<div class="ultp-block-wrapper">'; | |
| 266 | + $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 . '">'; | |
| 267 | + $wraper_before .= '<div class="ultp-block-wrapper" ' . $wrap_data . '>'; | |
| 261 | 268 | |
| 262 | 269 | // Loading |
| 263 | 270 | $wraper_before .= ultimate_post()->postx_loading(); |
| 264 | 271 | |
| @@ -303,9 +310,9 @@ | ||
| 303 | 310 | |
| 304 | 311 | include ULTP_PATH . 'blocks/template/category.php'; |
| 305 | 312 | |
| 306 | 313 | if ( $attr['queryUnique'] ) { |
| 307 | - $unique_ID[ $attr['queryUnique'] ][] = $post_id; | |
| 314 | + $ultp_unique_ID[ $attr['queryUnique'] ][] = $post_id; | |
| 308 | 315 | $current_unique_posts[] = $post_id; |
| 309 | 316 | } |
| 310 | 317 | |
| 311 | 318 | $post_loop .= '<' . $attr['contentTag'] . ' class="ultp-block-item post-id-' . $post_id . ( $attr['titleAnimation'] ? ' ultp-animation-' . $attr['titleAnimation'] : '' ) . '">'; |
| @@ -398,9 +405,9 @@ | ||
| 398 | 405 | $post_loop .= '</' . $attr['contentTag'] . '>'; |
| 399 | 406 | ++$idx; |
| 400 | 407 | endwhile; |
| 401 | 408 | if ( $attr['queryUnique'] ) { |
| 402 | - $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>'; | |
| 409 | + $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>'; | |
| 403 | 410 | } |
| 404 | 411 | // if ( ($attr['paginationShow'] || $attr['advPaginationEnable']) && ($attr['paginationType'] == 'loadMore')) { |
| 405 | 412 | // $wraper_after .= '<span class="ultp-loadmore-insert-before"></span>'; |
| 406 | 413 | // } |
| @@ -424,9 +431,9 @@ | ||
| 424 | 431 | $wraper_after .= '</div>'; |
| 425 | 432 | $wraper_after .= $pagi_block_html; |
| 426 | 433 | $wraper_after .= '</div>'; |
| 427 | 434 | |
| 428 | - wp_reset_query(); | |
| 435 | + wp_reset_postdata(); | |
| 429 | 436 | } else { |
| 430 | 437 | $wraper_before .= ultimate_post()->get_no_result_found_html( $attr['notFoundMessage'] ); |
| 431 | 438 | } |
| 432 | 439 | |