Quote:
Originally Posted by HowlingWulf
Now sure how TGPX works with images, but if they're attached to the posts you can use this function in your theme:
Code:
function total_images() {
global $wpdb;
$images= $wpdb->get_var("
SELECT COUNT(ID) FROM $wpdb->posts
WHERE (post_mime_type LIKE 'image/%')
AND post_type = 'attachment'
AND (post_status = 'inherit')
AND post_parent > 0
");
echo 'total attached images= '. $images;
}
|
In order to display total images just do this:
copy the function into the page where to display.
then "total_images();" this will invoke the function and echo the total images, if the query is correct ofcourse.
Dont use bash scripts for this.