2
我在的functions.php下面的代碼:的WordPress:獲取附件,而不是拇指後
function get_images($size = 'thumbnail') {
global $post;
return get_children(array('post_parent' => get_the_ID(), 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'));
}
在我single.php中
<?php $photos = get_images('full'); ?>
<?php $x = 0; ?>
<?php foreach($photos as $photo): ?>
<?php if($x < 1): ?>
<img src="<?=wp_get_attachment_url($photo->ID)?>" alt="fullImg" />
<?php endif; ?>
<?php $x++;
?>
<?php endforeach; ?>
我想在那裏只顯示一個圖像,但它顯示我也後拇指圖像,我不想要,有沒有一個選項可以排除?