Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using the Vote Me Up plugin http://wordpress.org/extend/plugins/vote-it-up/ on my site. I have the MostVotedAllTime function showing the top 10 posts. Currently this displays the Post Title only. I am wondering if it is possible to display a custom taxonomy associated with the post here.

for example it is a chart showing music albums where the post title is the album title. I have a taxonomy called artist which i would also like to display in the chart.

Does anybody know if this is possible or if there are any better plugins for this?

Here is the code for the MostVotedAlltime() function

function MostVotedAllTime_Widget() {
$a = SortVotes();
//Before

?>
<div class="votewidget">
<div class="title">Most Voted</div>
<?php
$rows = 0;

//Now does not include deleted posts
$i = 0;
while ($rows < get_option('voteiu_widgetcount')) {
if ($a[0][$i][0] != '') {
        $postdat = get_post($a[0][$i][0]);
    if (!empty($postdat)) {
        $rows++;

        if (round($rows / 2) == ($rows / 2)) {
            echo '<div class="fore">';
        } else {
            echo '<div class="back">';
        }
        echo '<div class="votecount">'.$a[1][$i][0].' '.Pluralize($a[1][$i][0], 'votes', 'vote').' </div><div><a href="'.$postdat->guid.'" title="'.$postdat->post_title.'">'.$postdat->post_title.'</a></div>';
        echo '</div>';
    }
}
if ($i < count($a[0])) {
$i++;
} else {
break; //exit the loop
}
}
//End
?>
share|improve this question

put on hold as off-topic by Pieter Goosen, kaiser 20 hours ago

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Add the code for the MostVotedAllTime() function. –  toscho May 12 '12 at 5:36
1  
Hi, edited post to include code for the MostVotedAllTime() function –  coolGeek May 12 '12 at 11:08

1 Answer 1

up vote 0 down vote accepted

Use get_the_term_list() to print the assigned terms.

Example:

    echo '<div class="votecount">' . /* stripped */ . '</div>';
    echo echo get_the_term_list( $postdat->ID, 'taxonomyname', 'Taxonomy Label: ', ', ', '' );
    echo '</div>';

Replace 'taxonomyname' and 'Taxonomy Label: ' with the values you actually need.

share|improve this answer
    
thanks.Just tried this however it displays the same taxonomy value for each post and not the one that is associated with the post –  coolGeek May 12 '12 at 12:08
    
Changing to get_the_term_list( $postdat->ID, 'artist', ' ', ', ', '' ); seems to have worked :) –  coolGeek May 12 '12 at 12:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.