| @@ -5,17 +5,20 @@ | ||
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | $the_query = isset( $args['template_args']['the_query'] ) ? $args['template_args']['the_query'] : ''; |
| 8 | 8 | $title = isset( $args['template_args']['title'] ) ? $args['template_args']['title'] : ''; |
| 9 | -$found_posts = ! empty( $the_query ) && ! empty( $the_query->found_posts ) ? $the_query->found_posts : 0; | |
| 9 | + | |
| 10 | +if(isset($the_query->found_posts) && $the_query->found_posts == 0){ | |
| 11 | + return; | |
| 12 | +} | |
| 10 | 13 | ?> |
| 14 | + | |
| 11 | 15 | <div class="container mb-1"> |
| 12 | 16 | <div class="row"> |
| 13 | - <div class="col-sm p-0 uwp-loop-posts-title"> | |
| 17 | + <div class="col-sm p-0"> | |
| 14 | 18 | <h3><?php echo esc_html( $title ); ?></h3> |
| 15 | 19 | </div> |
| 16 | - <?php if ( $found_posts ) { ?> | |
| 17 | - <div class="col p-0 d-none d-sm-block uwp-loop-posts-toolbar"> | |
| 20 | + <div class="col p-0 d-none d-sm-block"> | |
| 18 | 21 | <div class="btn-toolbar justify-content-end" role="toolbar" aria-label="Toolbar with button groups"> |
| 19 | 22 | <div class="btn-group btn-group-sm uwp-list-view-select" role="group" aria-label="First group"> |
| 20 | 23 | <button type="button" class="btn btn-outline-primary active uwp-list-view-select-list" onclick="uwp_list_view_select(0);"><i class="fas fa-th-list"></i></button> |
| 21 | 24 | <button type="button" class="btn btn-outline-primary uwp-list-view-select-grid" onclick="uwp_list_view_select(3);"><i class="fas fa-th"></i></button> |
| @@ -21,40 +24,28 @@ | ||
| 21 | 24 | <button type="button" class="btn btn-outline-primary uwp-list-view-select-grid" onclick="uwp_list_view_select(3);"><i class="fas fa-th"></i></button> |
| 22 | 25 | </div> |
| 23 | 26 | </div> |
| 24 | 27 | </div> |
| 25 | - <?php } ?> | |
| 26 | 28 | </div> |
| 27 | 29 | </div> |
| 28 | -<?php do_action( 'uwp_profile_posts_loop_wrap_start', $args, $found_posts ); ?> | |
| 29 | 30 | <div class="uwp-profile-cpt-loop"> |
| 30 | 31 | <?php |
| 31 | - do_action( 'uwp_profile_posts_loop_before', $args, $found_posts ); | |
| 32 | + | |
| 33 | + // The Loop | |
| 34 | + if ( $the_query && $the_query->have_posts() ) { | |
| 32 | 35 | |
| 33 | - if ( $found_posts ) { | |
| 34 | - // The Loop | |
| 35 | - if ( $the_query && $the_query->have_posts() ) { | |
| 36 | - echo '<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3">'; | |
| 36 | + echo '<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3">'; | |
| 37 | + while ( $the_query->have_posts() ) { | |
| 38 | + $the_query->the_post(); | |
| 37 | 39 | |
| 38 | - while ( $the_query->have_posts() ) { | |
| 39 | - $the_query->the_post(); | |
| 40 | + uwp_get_template( 'bootstrap/posts-post.php', $args ); | |
| 40 | 41 | |
| 41 | - uwp_get_template( 'bootstrap/posts-post.php', $args ); | |
| 42 | - } | |
| 43 | - | |
| 44 | - echo '</div>'; | |
| 45 | - | |
| 46 | - /* Restore original Post Data */ | |
| 47 | - wp_reset_postdata(); | |
| 48 | 42 | } |
| 43 | + echo '</div>'; | |
| 49 | 44 | |
| 50 | - do_action( 'uwp_profile_pagination', $the_query->max_num_pages ); | |
| 51 | - } else { | |
| 52 | - $no_items_message = '<span class="alert alert-info d-block uwp-no-items">' . esc_html( __( 'No items found.', 'userswp' ) ) . '</span>'; | |
| 53 | - | |
| 54 | - echo apply_filters( 'uwp_profile_posts_loop_no_items', $no_items_message, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 45 | + /* Restore original Post Data */ | |
| 46 | + wp_reset_postdata(); | |
| 55 | 47 | } |
| 56 | 48 | |
| 57 | - do_action( 'uwp_profile_posts_loop_after', $args, $found_posts ); | |
| 49 | + do_action( 'uwp_profile_pagination', $the_query->max_num_pages ); | |
| 58 | 50 | ?> |
| 59 | -</div> | |
| 60 | -<?php do_action( 'uwp_profile_posts_loop_wrap_end', $args, $found_posts ); ?> | |
| 51 | +</div> | |