Like the title says, what code would I use on a wordpress page so that it will only show posts that have a specific tag?
Leave a Reply
You must be logged in to post a comment.
Like the title says, what code would I use on a wordpress page so that it will only show posts that have a specific tag?
You must be logged in to post a comment.
I’m pretty sure I always read on here that
new WP_Query()
is recommended overquery_posts
. Additionally you can use the Transient API to improve performance on additional queries. Place this in whatever template where you’d like the list to display:And in your function.php you will need to clear out the transient when things are updated:
Before the loop, use query_posts function
This will returns all posts with the assigned tag.
You can also use it to return posts with multiple tags
For further parameters and reference, see
http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
http://codex.wordpress.org/Function_Reference/query_posts