views:

1185

answers:

3

I've noticed that a few Wordpress blogs have query statistics present in their footer that simply state the number of queries and the total time required to process them for the particular page, reading something like:

23 queries. 0.448 seconds

I was wondering how this is accomplished. Is it through the use of a particular Wordpress plug-in or perhaps from using some particular php function in the page's code?

+5  A: 

Try adding this to the bottom of the footer in your template:

<?php echo $wpdb->num_queries; ?> <?php _e('queries'); ?>. <?php timer_stop(1); ?> <?php _e('seconds'); ?>
pix0r
A: 

Thanks, works like a charm! Can you explain to me what's happening in that php code you gave?

Edit: @Carl thanks for clarifying. PHP has some neat tricks.

Kit Roed
+3  A: 

To explain pix0r's code:

Carl Russmann