程序进入搜索

时间:2011-11-28 16:40:31

标签: php wordpress wordpress-theming

这再次是一个wordpress问题。谢谢。提前 我的目标
1,请求url:localhost / search_encoded_searh_words.html
2,mod重写为:localhost / search.php?s = encoded_search_words
3, search.php 是我的创建文件,就像index.php一样,在开头有一行。 $ _GET [ 'S'] =解码($ _ GET [ 's' 的])
问题
wordpress判断这是页面文件请求而非搜索请求,标题显示页面未找到
简短
我想在解码搜索词后搜索 任何解决方法?

我的诀窍
search.php 中将REQUEST_URI修改为localhost /?s = decoding_search_words

1 个答案:

答案 0 :(得分:0)

尝试将网址重写为localhost/index.php?s=encoded_search_words, 然后在search.php中你需要从$query_string获取查询字符串,query_string看起来像“s = search_key”,你需要解析它并解码它。然后使用query_postcodex来改变查询结果。

query_posts( $args );

// The Loop
while ( have_posts() ) : the_post();
    echo '<li>';
    the_title();
    echo '</li>';
endwhile;

// Reset Query
wp_reset_query();