Pulling recent posts depending on the tag and current page’s title
-
Say I have a page that’s about a video game and I want to pull the 5 most recent posts from the blog that have the same tag as the name of the page. For instance, if the page is called World of Warcraft, I want to pull the 5 most recent posts from the blog that have the tag World of Warcraft. Anyone have a clue as to how to accomplish this?
So far, I’m using <?php wp_get_archives(‘title_li=&type=postbypost&limit=5’); ?> to get the recent posts, but I don’t know how to filter out the ones with the same tag as the page’s title 🙁
Maybe there will be something like this:
****this gets the tag of the post I think**** $current_tag = single_tag_title("", false); ****if post tag is the same as current page's title**** if ($current_tag == the_title()) { wp_get_archives('title_li=&type=postbypost&limit=5'); }Something like that. I don’t really know 🙁 I need a way to get a list of posts and only filter out the ones that have a tag that matches the title of the current page 🙁
The topic ‘Pulling recent posts depending on the tag and current page’s title’ is closed to new replies.