привет у меня есть этот код я создал в контент-gallery.php , но когда я использую Printf, чтобы показать количество фотографий в течение поста не показываетWordPress функции пост галерея не отображается количество сообщений
он должен быть напечатан [Эта публикация содержит 0 фото.] но не работает. Зачем? когда мои ошибки?
<?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