Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. $titles = get_the_title();
  2. $title_names = array();
  3. foreach ($titles as $title){
  4. $title_names[] = get_the_title($id);}
  5.  
  6. $the_query = new WP_Query(array(
  7. 'post_type' => 'post',
  8. 'post_status' => 'publish',
  9. 'meta_key' => 'colors',
  10. ));
  11.  
  12. while ( $the_query->have_posts() ) : $the_query->the_post();
  13.  
  14. $colors = get_field('colors');
  15.  
  16. if( $colors ): foreach( $colors as $color ):
  17. endforeach;
  18. endif;
  19. echo' <div><h2>'.$color.'</h2><div>'.get_the_title( $post_id ).'</div></div>';
  20.  
  21. endwhile; wp_reset_postdata();?>```
  22.  
  23. I'm thinking I need another if statement somewhere with an array?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement