A
A
Alexander Konovalov2018-08-17 15:27:09
WordPress
Alexander Konovalov, 2018-08-17 15:27:09

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

2 answer(s)
B
bk_maestro, 2018-08-17
@bk_maestro

Submit screenshots. There are no psychics here.

P
Pavel, 2018-08-18
@Palych_tw

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 5b77bc80e22a8887674781.png
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 question

Ask a Question

731 491 924 answers to any question