get post Foreach tag displays mutilple post in invalid array
-
Have this code to display $unique_thelocation(meta value) as Tags and display each post foreach tag but its not displaying well. Not sure if my code is right.
but i need help to display each post $unique_thelocation. Thank you!
$place = get_category(get_query_var('cat'))->name; echo '<div>'; query_posts( array ( 'category_name' => $place, 'posts_per_page' => 5 ) ); while (have_posts()) : the_post(); $args = array('location'=>'' ); $place = get_post_meta( get_the_ID(), 'place', true ); $place = wp_parse_args($place, $args); foreach($place as $key => $value) { $thelocations[] = $place[location]; } endwhile; $unique_thelocations = array_unique($thelocations, SORT_REGULAR); foreach($unique_thelocations as $unique_thelocation) { echo ' <li><a>' . $unique_thelocation . '</a>' '; if (have_posts() ) : while (have_posts()) : the_post(); echo '<p>'; the_title(); '</p>'; endwhile; endif; echo'</li> '; } echo '</div>';
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘get post Foreach tag displays mutilple post in invalid array’ is closed to new replies.