的數量您好,我有這樣的代碼我在內容gallery.php 創建但是當我用printf顯示的照片在帖子內的數量不顯示它WordPress郵寄畫廊功能不顯示職位
它必須打印 [此帖子包含9張照片。] 但不起作用。爲什麼? 當我的錯誤?
<?php
$the_images = get_children(array(
'post_parent' => $post->ID, // Pass the ID of a post or Page to get its children. Pass 0 to get attachments without parent. Pass null to get any child regardless of parent.
'post_mime_type'=> 'image', // A full or partial mime-type, e.g. image, video, video/mp4, which is matched against a post's post_mime_type field.
'post_type' => 'attachment',
'orderby' => 'menu_order',
'order' => 'ASC',
'numberposts' => 999
));
if (!empty($the_images)) {
$the_total_images = count($the_images);
$the_images = array_slice($the_images, 0, 10); // prin_r form 0 to 10 images
?>
<p><strong>
<?php printf (_n('This Post Gallery Contains %s Photo.', 'This Post Gallery Contains %s Photos.', $the_total_images, 'the-bootstrap'), $the_total_images); ?>
</strong></p>
<?php } ?>
你試過使用'sprintf()'而不是'printf()'? – Cyclonecode