Issue: ‘Load More Posts’ still visible when posts < 10

Function count_user_posts() used instead of wp_count_posts()
This commit is contained in:
denisbaranov
2019-02-26 13:08:49 +02:00
parent 4b154dd650
commit b575f8af3f
+3 -2
View File
@@ -61,8 +61,9 @@ if ( ! class_exists( 'um\core\User_posts' ) ) {
$args = apply_filters( 'um_profile_query_make_posts', $args );
$posts = get_posts( $args );
$count_posts = wp_count_posts();
$count_posts = ! empty( $count_posts->publish ) ? $count_posts->publish : 0;
//$count_posts = wp_count_posts();
//$count_posts = ! empty( $count_posts->publish ) ? $count_posts->publish : 0;
$count_posts = (int) count_user_posts( um_get_requested_user(), 'post', true );
UM()->shortcodes()->set_args = array( 'posts' => $posts, 'count_posts' => $count_posts );
UM()->shortcodes()->load_template( 'profile/posts' );