Last active
December 23, 2020 00:49
-
-
Save tdrayson/5014cfe452cc1a9be21e8cd6100ad943 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get the Custom Post Type | |
// -1 means we get all the posts type. | |
<?php | |
$things = get_posts(['post_type' => 'CPT','posts_per_page' => -1]); | |
//Start with 0 calories | |
$total = 0; | |
//Then Loop through all the posts in your CPT | |
Foreach($LotsofPosts as $singlePost): | |
//well grab the calories from each post | |
$post_data = get_field('field_name',$singlePost->ID); | |
$total = $total + $post_data | |
endforeach; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment