image - wordpress post gallery functions does not show the number of posts -


hi have code created in content-gallery.php when use printf show number of photos within post not show

it must print [this post gallery contains 9 photos.] not work. why? when errors?

<?php  $the_images = get_children( array(     'post_parent'   => $post->id, // pass id of post or page children. pass 0 attachments without parent. pass null child regardless of parent.     'post_mime_type'=> 'image', // full or partial mime-type, e.g. image, video, video/mp4, matched against 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 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 } ?> 

try using sprintf() instead of printf().

also, make sure not have spaces when using functions. spaces alright once within brackets, have space in printf () bad practice , of time errors or doesn't work.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -