Quick WordPress tip for you today! A reader recently asked about displaying the total number of blogroll bookmarks on their site. This sounds simple enough but not everyone meddles with code these days, so here is a nice PHP snippet that will do the job:
<?php $numlinks = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links WHERE link_visible = 'Y'"); if (0 < $numlinks) $numlinks = number_format($numlinks); ?>
Place that in your theme file and then customize the output by placing
<?php echo $numlinks; ?> wherever you would like to display the results.
A perfect example of this code in use can be seen at this random bookmark site.