0

我一直在考虑创建自己的自定义查询来使用$wpdb. 但是有一些事情我不太明白:

  1. 当结果进来时,它如何知道使用哪个模板文件来显示这些结果?
  2. 我在链接的href属性中输入什么将激活查询?
  3. 如果有很多结果,是否会像正常循环一样启用分页?
  4. 我是将查询放在文件中(在#1 中)还是在functions.php
4

1 回答 1

0

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.

于 2012-05-06T16:15:32.450 回答