I have the following situation in my PHP script:
foreach( $recent_posts as $recent ) {
/* something happens in here */
}
And:
foreach ($thumbnails as $thumbnail) {
if ( has_post_thumbnail($thumbnail->ID)) {
/* something other happens */
}
}
I would like to combine these two foreach
statements together.
I've seen a few solutions around here, but nothing really works for me.
edit: i want to do something like this
echo '<a href="' . get_permalink( $thumbnail->ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '"> '. $recent["post_title"] . get_the_post_thumbnail($thumbnail->ID, 'thumbnail', array('class' => 'beitragimg')).' </a>';