WordPress count your blogroll links

If you want to display total number of blogroll links you have? Then following code will be used to display the number of blogroll links.

<?php
$numlinks = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links WHERE link_visible = 'Y'");
if (0 < $numlinks) $numlinks = number_format($numlinks);
echo $numlinks;
?>
Credits

Jeff Star