Ik heb het opgelost. Hier is mijn code voor mensen die hetzelfde probleem hebben
<!-- Gives the homepage a different class then normal pages -->
<div <?php if (is_home()) { ?> id="aantal_homepage_home" <?php }
else { ?> id="aantal_homepage" <?php } ?> >
<!-- Direct SQL to retrieve and sum up the posts from 2010 -->
<?php
$bomen_sum_2010 = $wpdb->get_var($wpdb->prepare("
SELECT SUM($wpdb->postmeta.meta_value)
FROM $wpdb->postmeta, $wpdb->posts
WHERE $wpdb->postmeta.meta_key='gegroeide_bomen'
AND $wpdb->postmeta.post_id=$wpdb->posts.id
AND year($wpdb->posts.post_date)='2010'
"));
echo '<h1>' . $bomen_sum_2010 . '</h1>';
?>
<!-- You can add this line if you want to specify the month of the post
AND month($wpdb->posts.post_date)='12' -->
<p>
totaal aantal bomen
dit jaar dankzij <em class="oranje">Groen vervoer</em>
</p>
</div>