In <div id=“chart_rt”>%3$s</div> below, it is populated with a string that always begins with a number followed by a colon (from 1: to 25:). I see that ltrim removes characters from the beginning of a string but I don’t see how to compensate for the extra character in 10: through [B]25:
[/B]
function wp_rss( $url, $num_items = -1 ) {
if ( $rss = fetch_rss( $url ) ) {
echo '<div id="charts">';
if ( $num_items !== -1 ) {
$rss->items = array_slice( $rss->items, 0, $num_items );
}
//start count
$i = 1;
foreach ( (array) $rss->items as $item ) {
printf(
'<div id="chart_lt">'.$i.'</div><div id="chart_rt">%3$s</div>',
esc_url( $item['link'] ),
esc_attr( strip_tags( $item['description'] ) ),
htmlentities( $item['title'] )
);
//increment
$i++;
}
echo '</div>';
} else {
_e( 'An error has occurred, which probably means the feed is down. Try again later.' );
}
}