Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: [Waiting for user feedback] repeating field for images problem

$
0
0

How would I use types_render_field() in this context?

   
$attachments = get_posts(array(
	'post_type' => 'attachment',
	'post_parent' => $post->ID,
	'orderby' => 'menu_order',
	'order' => 'ASC'
	););
if ($attachments) {
	$i=0;
	    foreach ($attachments as $attachment) { 
	    echo '<div class="'; 
		if($i == 0) {echo 'active ';} //applies active class to first item only
		echo 'item">'.wp_get_attachment_image( $attachment->ID, 'homepage-banner', '', array('alt' => $attachment->post_title));
		echo '</div>';

        $i++;		
	    }
	}	

I would also want to use the size parameter in types_render_field to grab a specified thumbnail size.

I've tried reading your documentation but it's very generalised and doesn't provide any examples for foreach etc.


Viewing all articles
Browse latest Browse all 20145

Trending Articles