经过一些搜索,我找到了所需的参数:https://gist.github.com/luetkemj/2023628 (第231行)
//////Search Parameter
//http://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter
\'s\' => $s, //(string) - Passes along the query string variable from a search. For example usage see: http://www.wprecipes.com/how-to-display-the-number-of-results-in-wordpress-search
\'exact\' => true, //(bool) - flag to make it only match whole titles/posts - Default value is false. For more information see: https://gist.github.com/2023628#gistcomment-285118
\'sentence\' => true, //(bool) - flag to make it do a phrase search - Default value is false. For more information see: https://gist.github.com/2023628#gistcomment-285118
我补充道
\'s\' => $s
给我的
$args
它沿着查询字符串传递,这就是我要查找的内容:-)
我的代码现在看起来像:
$args = array(
\'paged\' => $paged,
\'posts_per_page\' => 9,
\'post_type\' => \'attachment\',
\'s\' => $s
);
query_posts($args);