Total number of JPG images, GIF, PNG in media libraries
To display the number of pages on the user side, I found the code, maybe it will be useful for someone. Just add this code snippet to function.php.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
function img_count(){ $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; } |
The second part of the code is needed to indicate the location, where to output number of images from media library.
1 2 3 |
<? img_count(); ?> |
/*
- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.