From 24d5f67040522f801489c77e769129aeb855657c Mon Sep 17 00:00:00 2001 From: Corey McKrill <916023+coreymckrill@users.noreply.github.com> Date: Thu, 24 Oct 2019 15:32:51 -0700 Subject: [PATCH] Theme: Display aggregated contributor data on single pledge view --- .../template-parts/5ftf_pledge-single.php | 81 ++++++++++++++----- 1 file changed, 60 insertions(+), 21 deletions(-) diff --git a/themes/wporg-5ftf/template-parts/5ftf_pledge-single.php b/themes/wporg-5ftf/template-parts/5ftf_pledge-single.php index fd222a0..e9a5dd0 100644 --- a/themes/wporg-5ftf/template-parts/5ftf_pledge-single.php +++ b/themes/wporg-5ftf/template-parts/5ftf_pledge-single.php @@ -2,8 +2,15 @@ namespace WordPressDotOrg\FiveForTheFuture\Theme; use WordPressDotOrg\FiveForTheFuture\Contributor; +use WordPressDotOrg\FiveForTheFuture\XProfile; use WP_Post; +$contribution_data = XProfile\get_aggregate_contributor_data_for_pledge( get_the_ID() ); + +$contributors = Contributor\get_contributor_user_objects( + Contributor\get_pledge_contributors( get_the_ID(), 'pending' ) // TODO set to 'publish' when finished testing +); + /** @var WP_Post $post */ ?> @@ -26,31 +33,63 @@ use WP_Post; {'5ftf_org-description'} ) ) ?> -
+ + - ++ %3$s hours per week.', 'wporg' ) ), + get_the_title(), + sprintf( + _n( '%d contributor', '%d contributors', $contribution_data['contributors'], 'wporg' ), + number_format_i18n( absint( $contribution_data['contributors'] ) ) + ), + number_format_i18n( absint( $contribution_data['hours'] ) ) + ); + ?> +
++ +
+