Declaração IF para filtrar artigo de imagem em destaque

Preciso do artigo de exibição da primeira página que tenha exibido a imagem.

Se o artigo apresentou a imagem carregada, exiba-a.

Se o artigo não tiver uma imagem destacada carregada, não a exiba.

Procurei on-line, o código de imagem destacado é:

https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/ 
https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/
https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/<?php }

Como adiciono a condição if no php abaixo? Tive muitos momentos para inseri-lo, mas deu errado.

 https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/ 'post', 'meta_key' => 'featured_post_add', 'meta_value' => '1', 'posts_per_page' => '15', 'no_found_rows' => true, ) ); ?> <section class="home-section featured-postshttps://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/"> 
https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/
<div class="section-titlehttps://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/">

https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/

https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/ https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/ https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/ https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/ https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/have_posts() ) : $posts_column = 0; // Count the posts ?>
https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/have_posts() ) : $ti_featured_posts->the_post(); if ( $posts_column == 0 ) : // Middle column $posts_image_size = 'rectangle-size-big'; $posts_width = ''; echo '
'; elseif ( $posts_column == 1 ) : // Right column $posts_width = 'grid-6'; $posts_image_size = 'rectangle-size-small'; echo '
'; // Close middle column elseif ( ( $ti_featured_posts->current_post + 1 ) == ( $ti_featured_posts->post_count ) ) : // Close right column echo '
'; endif; $posts_column++; endwhile; ?> https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/
https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/

https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/

https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/

Pergunta editada

De Michał Skrzypek sugeriu,

 
<a href="https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/"> https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/<?php if ( has_post_thumbnail() ) { the_post_thumbnail( $posts_image_size ); } elseif( first_post_image() ) { // Set the first image from the editor echo ''; } ?>

mudar para

 
<a href="https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/"> https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/
<a href=https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/"><img src="https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/" title="https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/" />
https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/

Isso resulta em

insira a descrição da imagem aqui

O artigo sem imagem em destaque ainda está sendo exibido.

O título está sendo exibido. Não mostra antes.

 “title=”I accidentally broke the super-rugged Cat S60 smartphone”/> 

Solutions Collecting From Web of "Declaração IF para filtrar artigo de imagem em destaque"

Se eu entendi você corretamente, você quer que a imagem em destaque seja exibida ou não com base em se foi carregado ou não. Em caso afirmativo, o código básico é:

 https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/< ?php if( has_post_thumbnail() ) { ?> "> https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/< ?php } ?> 

E isso exibe a imagem ligando para a postagem. Do código que você forneceu praticamente, sente que deseja include a imagem lá:

 
https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/< ?php if ( has_post_thumbnail() ) { the_post_thumbnail( $posts_image_size ); } elseif( first_post_image() ) { // Set the first image from the editor echo ''; } ?>

A coisa é que, nesta forma, seu código exibe algo se a imagem em destaque é exibida ou não, então você basicamente precisa envolver todo esse código na instrução if e se livrar dele no meio, assim:

 https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/< ?php if( has_post_thumbnail() ) { ?> 
">
https://wordpress.stackexchange.com//questions/231934/if-statement-to-filter-featured-image-article/< ?php } ?>

Agora, a declaração verifica se a sua publicação possui uma imagem destacada anexada e, em seguida, tenta exibi-la com toda a class.
Deixe-me saber como isso foi para você e se eu entendi o que quis dizer.