As far as I know, WordPress has no function to count the number of pictures in the article, so to get the total number of pictures in the article, you can only add your own WordPress code.
This function is not difficult to achieve, a few lines of code can be done, search on the Internet also has a lot of similar tutorial.
A small function can make the theme function more rich, like friends can test under their own.
usage method
First, add the following code to the functions.php File.
// WordPressGet the number of pictures in the article if( !function_exists('get_post_images_number') ){ function get_post_images_number(){ global $post; $content = $post->post_content; preg_match_all('/<img.*?(?: |\t|\r|\n)?src=['"]?(.+?)['"]?(?:(?: |\t|\r|\n)+.*?)?>/sim', $content, $result, PREG_PATTERN_ORDER); return count($result[1]); } }
Then add the following code where you need to count the number of pictures in the article.
Note: it needs to be put in circulation when using.
<?php echo get_post_images_number().'Picture' ?>