Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 112606

Cooper Dukes on "Display Sum of meta values"

$
0
0

UNTESTED

<?php
$revenue = 0;
query_posts('category_name=active-project');
while (have_posts()) : the_post();
$revenue .= get_post_meta($post->ID, 'revenue', true);
endwhile;
echo '<p>'.$revenue.'</p>';
?>

Might have to validate the metas as numbers, or use + instead of .=


Viewing all articles
Browse latest Browse all 112606

Trending Articles