Any way to provide custom select query to the loop?
I’m building a plugin to provide post tagging for my WP blog (yes, I’m aware plugins already exist for this, I’m doing this more for my own plugin learning curve), and I’m storing the tags via custom fields (ie in wp_postmeta).
I’ve created a page based on a template in which I intend to display all posts with a given tag (so, you would click on a tag link in a post, and it should take you to this page with the tag name in the URL).
I’m trying to work out if there’s a way to provide a custom SELECT query to The Loop – something like:
SELECT p.* FROM wp_posts p, wp_postmeta pm WHERE p.ID = pm.post_id and meta_key='tags' and meta_value='value_of_tag'
I’ve spent a couple of hours trying to find something to tell if this is possible or not in the docs, and the few other tag plugins I’ve found just link to technorati, not to a page where all entries with that tag are displayed.
Any help appreciated!
- The topic ‘Any way to provide custom select query to the loop?’ is closed to new replies.