Wie kann ich bei php/Wordpress die Beitragsbilder anzeigen lassen?

1 Antwort

Hallo,

du könntest es so lösen:

<div class= "wp_liste">

<?php

global $post;

$child_pages_query_args = array(

  'post_type'  => 'page',

  'post_parent' => $post->ID,

  'orderby'   => 'date DESC'

);

$child_pages = new WP_Query( $child_pages_query_args );

if ( $child_pages->have_posts() ) :

?>

<ul class="child_page_row">

<?php 

while ( $child_pages->have_posts() ) : $child_pages->the_post();

?>

<li><a href="<?php the_permalink(); ?>">

<?php if(has_post_thumbnail()): ?>

<div class="child_page_thumb">

<?php the_post_thumbnail(array(240, 240)); ?>

</div>

<?php endif; ?>

<div class="child_page_name">

<?php the_title(); ?>

</div>

</a></li>

<?php

endwhile; 

?>

</ul>

<?php   

endif;

wp_reset_postdata();

?>

</div>

Habe es etwas vereinfacht, Quelle ist hier: https://studiofreya.com/wordpress/how-to-list-child-pages-with-thumbnails-in-a-wordpress-theme/

Viele Grüße

Timon