嘗試
$ar = array (
'post_type'=>'recipes',
'taxonomy'=>'recipescategory',
'category_name'=>'Starters'
);
$posts = get_posts($ar);
** foreach循環**
foreach($posts as $p){ ?>
<div class="sub_cont">
<div class="sub_img">
<?php $url = wp_get_attachment_url(get_post_thumbnail_id($p->ID));?>
<a href="<?php echo $permalink = get_permalink($p->ID); ?>"><img src="<?php echo $url; ?>" longdesc="URL_2" alt="Text_2" /> </a>
</div>
<div class="desc_title">
<a href="<?php echo $permalink = get_permalink($p->ID); ?>">
<?php echo $post_title=$p->post_title; ?>
</a>
</div>
<div class="cont_add"></div>
</div>
<?php } ?>
感謝您的寶貴建議!祝你有個美好的一天 – 2014-11-15 09:44:31
沒問題,我對你的其他問題留下了一個評論,試試這個問題給出的代碼。如果你沒有對,請留下評論 – 2014-11-15 09:45:42