Total image counting is not a important thing. but if you know this trick, you will show total number of usage image in any place of your wordpress site or blog. for show total number of usage image copy this code:
after copy this code paste it into your themes 'functions.php' file. now copy another code from bellow:
after copy this code paste it in your theme where you want to show total number of image in your wordpress site.
function img_count(){PROBLEM COPY CODE? TRY HERE!!
$query_img_args = array(
'post_type' => 'attachment',
'post_mime_type' =>array(
'jpg|jpeg|jpe' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
),
'post_status' => 'inherit',
'posts_per_page' => -1,
);
$query_img = new WP_Query( $query_img_args );
echo $query_img->post_count;
}
after copy this code paste it into your themes 'functions.php' file. now copy another code from bellow:
<?PROBLEM COPY CODE? TRY HERE!!
img_count();
?>
after copy this code paste it in your theme where you want to show total number of image in your wordpress site.
0 comments:
Post a Comment
Comments here