Advertisement
Guest User

Untitled

a guest
Dec 18th, 2021
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1.     if($query->have_posts()) {
  2.         while ($query->have_posts()) : $query->the_post();
  3.             if ($array_keys) {
  4.                 $stores[] = array(
  5.                     'id' => get_the_ID(),
  6.                     'name' => $query->post->post_title
  7.                 );
  8.             } else {
  9.                 if(!$return_id) {
  10.                     $stores[$query->post->post_title] = $query->post->post_title;
  11.                 } else {
  12.                     $stores[get_the_ID()] = $query->post->post_title;
  13.                 }
  14.             }
  15.         endwhile;
  16.         wp_reset_postdata();
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement