Display Total Number of Blogroll Bookmarks
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. You can add this code anywhere in your theme template (wherever you want to display the total 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); ?>
Place that in your theme file and then customize the output by placing <?php echo $numlinks; ?>
wherever you would like to display the results. Nifty!
3 responses
-
have a excellent site. I read all your post and 45 pages . thank you
-
why don’t you use
$wpdb->get_var("SELECT * FROM $wpdb->links WHERE link_visible = 'Y'");