Tuesday, 9 October 2018

how to limit show meta value per page

Edited : I have a code , this code show meta_post and from meta_post i will show image with wp_get_attachment_image, every post have a value_gallery in 1 array and value of array is id-attr image , 1 value_gallery have 2 or more id-attr separated by comma , so i want make post paginate , but i dont know how make it , i was make this code on single-gallery.php ,

$value = get_post_meta(get_the_ID(),'value_gallery',false); 
foreach ($value as $key ) {
 $values = explode(",",$key);
 foreach ($values as $keys) {
     $args = array(
  'meta_key' => 'value_gallery',
  'meta_value' => $keys,
  'post_per_page' => 4
  );
  $res =  new WP_Query($args);
  if ($res->have_posts()) {
  $id = get_the_ID();
  echo $key;

  }else{
  echo "not found";
  }
 }
}

i want make this code like this , but this code still just show "not found" , if anyone can help me , i will so very happy

note : value of meta_value value_gallery is array ex : array(1) { [0]=> string(29) "1402,1435,1398,1434,1434,1434" } thankyou for your attention



from how to limit show meta value per page

No comments:

Post a Comment