Passing array data to a variable
-
How do I pass the contents of $the_slug array to the $post_name variable in the loop?
$tags = get_the_tags(); foreach ($tags as $tag){ global $post; $the_slug = $tag->slug; //contains 10ish words that associate with my permalinks: welcome, home, about, contact, etc $post_id = 'welcome'; $post_name = $the_slug; //fails to populate here $queried_post = get_post($post_name); //if changed to $post_id works but only 'welcome' post $excerpt = $queried_post->post_excerpt; $excerpt = apply_filters('the_content', $excerpt); $excerpt = str_replace(']]>', ']]>', $excerpt); echo $excerpt . "\n\n"; }
Thanx for looking,
Sam
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Passing array data to a variable’ is closed to new replies.