Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Lester Chan

    (@gamerz)

    You can probably get all the post ID that the author has make and base on the post ids, get the post meta “ratings_score” and sum it all up.

    Thread Starter andy999

    (@andy999)

    I found this little snippet kicking around but it doesn’t seem to output anything when I put it on the author page, what am I doing wrong?

    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;
    
    }
    ?>
    Plugin Author Lester Chan

    (@gamerz)

    Because the function is returning the $score instead of printing it out?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show number of points on author page?’ is closed to new replies.