我将Searchform.php修改为:
'search_id' => 'id', 'form_action' => ( 'http://local.amleo.com/newps/pulldata.php'对于第一个搜索小部件,转到一个显示其他内容结果的自定义PHP页面。
下一个搜索Widget,我想搜索类别"AML热点主题“。不知道我怎么能做到。有什么主意吗?
所以你可以可视化:http://i.imgur.com/HSd9EEZ.png
第一次搜索是我修改了Searchform.php的搜索。第二个是我不确定的那个。
我不是超级欺骗的PHP向导,但我可以非常体面地遵循指示。
发布于 2013-11-01 15:11:17
你不需要两个目标来搜索,相反你可以这样做
newps的一种形式
<form method="get" id="searchform" action="<?php echo esc_url( home_url() ); ?>">
<input type="text" value="<?php echo esc_attr( get_search_query() ); ?>" name="s" id="s" />
<input type="hidden" value="newps" name="key" />
<input type="submit" id="searchsubmit" value="<?php esc_attr_e('Search','Aggregate'); ?>" />
</form>另一个用于AML
<form method="get" id="searchform" action="<?php echo esc_url( home_url() ); ?>">
<input type="text" value="<?php echo esc_attr( get_search_query() ); ?>" name="s" id="s" />
<input type="hidden" value="aml" name="key" />
<input type="submit" id="searchsubmit" value="<?php esc_attr_e('Search','Aggregate'); ?>" />
</form>在主题的根文件夹中创建一个search.php文件,如下所示
get_header();
// if you get `key` then it will be your custom search
// otherwise, default search will be performed
if(!empty($_GET['key'])) {
$key = $_GET['key']; // it will be either 'newps' or 'aml'
$search = $_GET['s'];
// modify the query using your $key and $search param
query_posts(...);
}
if (have_posts()) :
while(have_posts()): the_post();
// the_title() and more...
endwhile;
endif;
// reset the query if modified
if(!empty($key)) wp_reset_query();
get_sidebar();
get_footer();https://stackoverflow.com/questions/19728607
复制相似问题