I'm using the following function to get some posts based on their vote (Vote it Up plugin):
function top_voted($number){
$a = SortVotes();
echo '<div class="voted">';
$rows = 0;
//Now do not include deleted posts
$i = 0;
while ($rows < $number) {
if ($a[0][$i][0] != '') {
$postdat = get_post($a[0][$i][0]);
if (!empty($postdat)) {
$rows++;
echo '<div class="fore">';
echo '<div class="votecount" style="width: 1em; color: #555555; font-weight: bold;">'.$a[1][$i][0].' </div><div><a href="'.$postdat->guid.'" title="'.$postdat->post_title.'">'.$postdat->post_title.'</a></div>';
echo '<div class="votecount" style="width: 1em; color: #555555; font-weight: bold;">'.$a[1][$i][0].' </div><div>'.$postdat->post_content.'</div>';
echo '</div>';
}
}
if ($i < count($a[0])) {
$i++;
} else {
break; //exit the loop
}
}
echo '</div>';
}
I would like to only get the posts of a certain post type. I think I have to do something with get_post
but I'm not familiar with it.
Any suggestions?