get_posts and foreach
-
I’m using get_posts to display attachments of my posts:
<?php $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts($args); if ($attachments) { foreach ( $attachments as $attachment ) { echo apply_filters( 'the_title' , $attachment->post_title ); the_attachment_link( $attachment->ID , false ); } } ?>How can I change the code to exclude the echo so I can simply write out the HTML for the attachments?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘get_posts and foreach’ is closed to new replies.