<?php
$totalprice_posts = get_posts('post_type=items&author=".$thisauthorID."&tag='.$thispostID.'&numberposts=-1');
$totalprice_array = array();
foreach ($totalprice_posts as $post) {
$productprice = get_post_meta($post->ID, "productprice", true);
$productquantity = get_post_meta($post->ID, "productquantity", true);
$totalproductprice = ($productprice * $productquantity);
array_push($totalprice_array, $totalproductprice);
}
echo implode(',', $totalprice_array);
echo array_sum($totalprice_array);
?
Related Posts:
- Advanced Custom Fields – display label and value only if value entered
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Order a WP_Query by meta value where the value is an array
- WP post meta – for loop inside for loop
- Store custom field’s multiple values in one user meta key
- Grabbing value of input field inside of array
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Exclude posts based on meta value
- how to retrieve a value if a checkbox is checked
- Trouble checking if custom woocommerce checkout field is empty or not
- Two queries for a WP_User_Query search work perfectly apart, but not together
- auto-populating custom nav with all items from custom post type
- Checking array against author id in loop
- Add / Update Custom Fields After Select Pictures in Media Window
- conditional logic for front-end custom field edits
- Trying to retrieve post meta
- Automatic Shortcode Creation with Custom Fields [closed]
- Custom field values to taxonomy terms
- How would an if statement surrounding a custom field with two variables (holding values) look like?
- Redirect to another page using contact form 7? [closed]
- How to add specific meta tags to head of cart and checkout pages in woocommerce?
- Alter required message using comment form api
- Custom Field IF/ELSE PHP
- Which PHP page is the Default Posts Page
- How to combine 2 php functions into one function with a custom field
- Remove the last X characters of a custom field value
- Is it possible to retrieve all posts with a certain value for metadata?
- meaning of (array)function()
- Grouping posts by a custom meta value
- Saving zero in meta box
- Non-Closing PHP Query in WordPress Loop
- wp_force_remove_style’ not found
- Find a way to retrive data updated through metabox plugin to web page
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- Why are the details of my todo not saving?
- How can I access string value in an array?
- How to use if statement in an array? [closed]
- How to check if a PHP string is different than meta field?
- Can’t save php string to a custom field
- How to array only one key from another array
- Display custom field on 404 page outside loop
- Filtering a function’ output for a new continued function
- Why does this update_post_meta function not delete the custom field itself?
- How to show/hide php table rows based on the content of custom fields
- Run str_replace on title and save the output to a custom field
- Get html data with javascript to php array and store to wordpress database
- How do I create a numbered list with PHP? [closed]
- Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?
- How to use array in function to get only value I want
- Only show image from custom field when present
- Error while setting role
- Get categories names as an array to use it in theme settings
- how to get serialized post meta
- Hide Heading if ACF Field is empty
- How to get the last category name of a child category?
- Custom meta box values are not getting saved for my custom post type
- How to say if meta_value is greater than 0 in an array?
- How to use two meta_compare in an array?
- Warning: in_array() null given in PHP function
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- WP_Query: getting posts where custom field exists
- Foreach loop inside an array_merge
- How to show meta value code HTML after x paragraph
- Creating an image from a custom field
- Loop over Array and get the distinct ids
- How to access or parse key/values that have “string”
- If Array Values Match Another Array’s Values, Then
- User Meta Value not echoing despite Var_Dump Showing correct string
- Remove empty terms from array, sort alphabetically, update back to repeating field
- Only show first image in foreach loop
- Conditional multidimensional arrays and array_map
- if custom field doesn’t exist, use post thumbnail instead, as image background
- How can I get all values from my array in a loop in php? [closed]
- WP All Import / Update stock quantity from multiple XML files
- Getting posts to exclude from array
- Get all posts as an array ID => Name
- How to store multiple custom meta box
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- I’m unable to call img path using single quotes in an array?
- Filter by field with array value in ACF on WP REST API
- extract serialized array to use for wp-query
- get users search not working with array
- Handling repeater data
- How to add data to a custom field at the wp_users table?
- Comapare get_user_meta value
- How can get all users by current user meta?
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Get the id of all images in a post
- Output category list inside array
- how to make an array of post id’s in is_single
- Concatenate Custom Field Value & HTML Value
- How can I split my query result in 2 arrays?
- Multidimensional Array
- Separate array output into a
- array_rand not working correctly?
- Output custom text field as unordered list
- Get css class of menu item in custom menu structure
- Conditional featured image with youtube thumbnail
- Dynamically adding filters
- `update_post_meta` not working anymore