I’ve been thinking of creating my own custom query to get data using $wpdb. But there are just some things I don’t quite understand:
- When the results come in, how will it know which template file to use to display those results?
- What do I type in the link’s
hrefattribute which will activate the query? - Should there be many results, will pagination be enabled like a normal loop?
- Do I put my query in a file (in #1) or in
functions.php?
If you want to create new custom loop, you can create new template for it. In this case pagination, loop work normally. You just place custom wp_query above loop. And in href you must write url of page which built on new custom template. For understanding all this process step by step i suggest you to read my article in wptuts. It is called “Creating a Custom ‘The Posts I Commented On’ Loop” and it is the guide what you need.