<?php
$post_id = get_the_ID();
foreach((get_the_category()) as $cat) {
$cat_id = $cat->cat_ID ;
break ;
}
query_posts(
array(
'cat' => $cat_id,
'showposts' => 4, //出力件数
'post__not_in' => array($post_id)
)
);
?>
<?php if(have_posts()) : ?>
<div id="list">
<ul class="blocks-4">
<?php while (have_posts()) : the_post(); ?>
<li> <?php
$attach_id = get_post_meta($post->ID,"画像1PC",true);
$image_info = wp_get_attachment_image_src( $attach_id , 'full' );
list( $url, $w, $h) = $image_info;
$h = intval(200 * ( $h / $w ));
$alt = get_post_meta($attach_id , '_wp_attachment_image_alt', true);
?>
<a href="<?php the_permalink() ?>"><img src="<?php echo $url; ?>" alt="<?php echo $alt; ?>" height="95px" /></a>
<b><?php the_title(); ?></b><br />
<?php echo get_post_meta($post->ID,"間取り",true); ?><br />
<?php echo get_post_meta($post->ID,"所在地",true); ?><br />
<?php echo get_post_meta($post->ID,"賃料",true); ?>
</li>
<?php endwhile; ?>
</ul>
</div>
<?php endif; ?>
<?php wp_reset_query() ?>
不動産サイトやネットショップなどで便利かもしれませんね