Function to return the meta value as per author.
<?php
function ac_author_score() {
$userID = get_the_author_meta( 'ID' );
$query = array (
'author' => $userID,
'posts_per_page' => -1
);
$queryObject = new WP_Query($query);
while( $queryObject->have_posts() ) : $queryObject->the_post();
global $post;
$postID = $post->ID;
$score = $score + intval( get_post_meta( 'ratings_score', $postID, true ) );
endwhile;
wp_reset_query();
if ( $score > 0 )
$score = '+' . $score;
return $score;
}
?>
So it's returning the $score, but I can't get it to output anything with echo etc.
How do I actually print/echo the returned value?
$score = 0;
at the beginning and see if you can print that.echo ac_author_score();
, right?!