Feature Image and inserted image
-
Hi!
I’m having a problem in a website that I’m building.
Currently I’m using the Feature Image as a post background.<?php global $post; ?> <?php $args = array( 'numberposts' => 20 ); $lastposts = get_posts( $args ); foreach($lastposts as $post) : setup_postdata($post); ?> <div class="adsContainer" style="background-image: url('<?php $attachments = get_children( array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' =>'image') ); foreach ( $attachments as $attachment_id => $attachment ) { echo wp_get_attachment_url( $attachment_id, 'medium' ); } ?>')"> <div id="textHolder"><?php the_content(); ?></div><!-- end of textHolder --></div> <?php endforeach; ?>
But I also need to be able to show an image inserted into the post.
Does it make sense? I need a background for each post (it’s working fine) but I also need to be able to display a image inserted in the post.
Thanks
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘Feature Image and inserted image’ is closed to new replies.