我在搜索栏中使用以下代码。单击提交时,它什么都不做。它甚至没有指向另一页。我正在使用Understrap主题。
<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 :(得分:0)
将action
属性设为您的网站网址,而不是'/'
。有时&#39; /&#39;想要有用。
<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>