Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $titles = get_the_title();
- $title_names = array();
- foreach ($titles as $title){
- $title_names[] = get_the_title($id);}
- $the_query = new WP_Query(array(
- 'post_type' => 'post',
- 'post_status' => 'publish',
- 'meta_key' => 'colors',
- ));
- while ( $the_query->have_posts() ) : $the_query->the_post();
- $colors = get_field('colors');
- if( $colors ): foreach( $colors as $color ):
- endforeach;
- endif;
- echo' <div><h2>'.$color.'</h2><div>'.get_the_title( $post_id ).'</div></div>';
- endwhile; wp_reset_postdata();?>```
- I'm thinking I need another if statement somewhere with an array?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement