2016-04-10 22 views
0

我使用下面的代碼爲搜索欄。當你點擊提交時,它什麼都不做。它甚至沒有指向另一個頁面。我正在使用Understrap主題。WordPress的搜索沒有提交

<div id="search"> 
         <form action="/" method="get"> 
          <input type="search" placeholder="Type your search word(s) here" value="<?php get_search_query(); ?>" /> 
          <button type="submit" class="btn btn-primary">Search</button> 
         </form> 
        </div> 

回答

0

action屬性您的網站網址,而不是'/'。有時'/'想要有用。

<div id="search"> 

    <form method="get" id="searchform" action="<?php bloginfo('url'); ?>"> 

    <input type="search" placeholder="Type your search word(s) here" value="<?php get_search_query(); ?>" /> 
     <button type="submit" class="btn btn-primary">Search</button> 
     </form> 
    </div>