Try this:
//loop start
$total_amount = get_post_meta($post->ID, 'custom_field1', true);
$total_amount += get_post_meta($post->ID, 'custom_field2', true);
$total_amount += get_post_meta($post->ID, 'custom_field3', true);
//loop end
echo 'Total: '.$total_amount;
Related Posts:
- How to solve suspected memory issue in custom WordPress loop?
- WP_Query on custom post type not displaying, multiple loops & get_template_part
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- Get_post_meta() won’t return value
- Display custom post on home page based on a metabox selection
- wp_query to find posts by year and month
- Create a random unique 6 digit number as custom field for custom post type
- How to insert content from another Custom Post type into Post?
- WP_Query orderby modified to include custom meta changes
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Meta Key Value in current-user-only loop
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- How to conditionally add Custom Post Type to Front Page
- hide specific div on single.php [closed]
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- How do you output an unknown number of images in a custom post type with desired markup?
- Get data from PHP to JavaScript to set position of each post on front page
- Get post content from another section in custom single page
- Displaying information from custom field on custom post type
- Get post-meta value of all custom-posts – lowest to highest year-count?
- Custom PT, Taxonomys and wordpress query
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- How do I list a custom field and custom taxonomies for each result in a loop?
- How can i loop through custom post type according to custom meta field?
- How to sort WP_Query by a custom text field (written as a date dd/mm/yyyy)
- when looping through custom post data not appearing
- How to avoid duplicate posts queried from custom meta?
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- Adding a Section for Visitors
- sorting in wp query based on custom field value
- Custom taxonomy template for custom fields loop [closed]
- Sort loop by custom field from different post type
- WordPress query in which condition uses custom field
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- Error in WP Query. If variable is empty it is displaying previous post value
- WordPress loop, show only one post per custom field
- How to get past and upcoming post by defining date in custom field?
- Order by custom field attribute
- Get result from Custom Field in Custom Post type
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- loop through custom post-type with two meta_keys
- How do I filter a custom post type loop by a field?
- Custom Post Type Data in Sidebar widgets?
- Hide custom post type field from author?
- Many to Many Relationship between Two Custom Post Types
- wordpress plugin error handling
- Creating Photo Gallery System with Custom Post Type
- Set post title from two meta fields
- Trying to save custom post type from frontend partially working
- Custom Taxonomy order by Custom Field
- Is there any performance consideration when using Custom Post Types?
- Loop on front-page.php
- Custom Post Type Navigation on Custom Field
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- how to interconnect custom post types?
- Am unable to reset a query properly
- Add field to all custom post types
- Dynamic dropdown select values depending on other custom field value
- Grouping metadatas into one
- Shortcode not working with post counter
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- How to Output which matched meta_keys were found from custom_type_posts?
- How to let users choose where to search for posts?
- pagination not working for category.php (custom post types in categories)
- Query based on custom fields start and end date
- Custom Post Type single.php template only shows the latest post
- DIsplaying URL of custom field in last post of certain taxonomy && post type
- WP_Query orderby not work with meta_key
- How do I replace the post title with a custom field?
- How to display wp_post by custom field value?
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- Custom Taxonomy dont save in a frontend form for post a custom post
- Update custom field value
- Should i use custom post type for a custom footer?
- Display category name of custom posts only once in the loop
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- Custom taxonomy terms as children of multiple custom post types
- Make bootstrap 5.0 carousel dynamic using ACF and CPT UI [closed]
- Pagination Not Working When Used With WP_Query() `offset` Property
- How to access repeater field of a custom field?
- PHP Warning with Custom Fields
- Custom post types & Pages hierarchy – Error 404
- filter rest api post by a acf filed
- How to prepend text to custom field value A, but only if custom field value B matches a certain string?
- Custom post type that lets users create a set of posts?
- Delete custom post type metadata without deleting the post in admin area
- Creating multiple CPT posts from one Gravity form
- Function not pulling image or text from custom post type
- Sorting custom post types by taxonomy (So close)
- Repeatable custom meta select boxes
- Types plugin isn’t compatible with my custom post type
- Show Posts in Vertical Tabs with Scrollbar
- Custom Post type as Taxonomy
- Display div based on Group metabox selection [closed]
- Is it possible to specify a time interval (from, to) in ACF with date picker, or other custom field?
- How to consume external API from WordPress post editor and display the response data in the custom field?