Add custom fields from different posts

<?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); ?

Filter or order based on custom field

I have added a custom field to some posts called ‘frontpagerank’ Then shouldn’t the WP_Query args reference that key then, eg. ‘meta_key’ => ‘frontpagerank’ If i follow, you want to check for posts that have this key, and you’re expecting a numeric value, so i’ll naturally assume you don’t want posts with this key(but an … Read more

Change Page Order by Custom Field (Magic Fields)

I tested this code and it works great: <?php query_posts(‘meta_key=price&orderby=meta_value_num&post_parent=”.$post->ID.”&post_type=page’); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class=”page” id=”post-<?php the_ID(); ?>”> <div class=”pagecontent”> <div class=”grid”> <a href=”https://wordpress.stackexchange.com/questions/13375/<?php the_permalink(); ?>” title=”<?php the_title(); ?>”> <?php $attachments = get_children( array ( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘numberposts’ => 1, … Read more