Notetu

記事にアップロードされている画像を表示する

<table>
<tr>
<td>
<?php
	$count = 1;
	$attachments = get_children("post_parent=$post->ID&post_type=attachment");
	$max = count($attachments);

	foreach ( $attachments as $id => $attachment){
		echo "<img src='".$attachment->guid."' alt='".$attachment->post_title."' width='195'>";
		echo "<br>";
		echo $attachment->post_content;
		if($max>$count){
		echo "</td><td>";
		}
		$count++;

	}
?>
</td>
</tr>
</table>