Answer the question
In order to leave comments, you need to log in
How to display only one picture in the post announcement?
Hello! On the page with WP posts, the entire article is displayed with all the pictures, how to make it show only one, the first picture?
Answer the question
In order to leave comments, you need to log in
Judging by the code and screenshots, you display the entire content of the post through the_contetnt();
. And the point here is not the number of pictures, but the fact that you generally display the entire record in its entirety. If you need to display only the announcement, use it, the_excerpt()
and to display the thumbnail, use the_post_thumbnail();
These functions should be used INSIDE the post output loop, if you don’t understand what this is about, learn php.
PS Thumbnail to the post clings here
If this metabox is not present, then in the functions.php of your theme you need to add add_theme_support( 'post-thumbnails' );
PPS Do not use query_posts()
it ever. Use WP_Query instead
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question