下面的函数显示了投票最多的帖子的前10个图表。如何向此图表中添加加入的数字
eg公司
1 - 示例Post1
2 - 示例Post2
等
function MostVotedAllTime_Widget() {
$a = SortVotes();
//Before
?>
<div class="JibbleChart">
<div class="title">Most Recommended Albums</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 get_the_term_list( $postdat->ID, \'artist\', \' \', \', \', \'\' );
echo \' - <a href="\'.$postdat->guid.\'" title="\'.$postdat->post_title.\'">\'.$postdat->post_title.\'</a>\';
echo \'</div>\';
}
}
if ($i < count($a[0])) {
$i++;
} else {
break; //exit the loop
}
}
//End
?>
</div>
<?php
}
最合适的回答,由SO网友:Eugene Manuilov 整理而成
Use this:
function MostVotedAllTime_Widget() {
$a = SortVotes();
//Before
?>
<div class="JibbleChart">
<div class="title">Most Recommended Albums</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 get_the_term_list( $postdat->ID, \'artist\', \' \', \', \', \'\' );
echo \' - <a href="\'.$postdat->guid.\'" title="\'.$postdat->post_title.\'">\'.$i.\' - \'.$postdat->post_title.\'</a>\';
echo \'</div>\';
}
}
if ($i < count($a[0])) {
$i++;
} else {
break; //exit the loop
}
}
//End
?>
</div>
<?php
}