render( $block, $content, $postId ); } protected function render( $block, $content, $postId ) { $postTypePrefix = 'acfg_'; $postTypeKey = 'set'; $posts = get_posts([ 'post_type' => $postTypePrefix . $postTypeKey, 'numberposts' => -1 ]); $totalReps = 0; $totalMinutes = 0; foreach( $posts as $post ) { if( get_field('unit', $post->ID) == 'reps' ) { $totalReps += (int) get_field('value', $post->ID); } if( get_field('unit', $post->ID) == 'minutes' ) { $totalMinutes += (int) get_field('value', $post->ID); } } print '