admin管理员组文章数量:1297075
So I have a .html page under my Wordpress website and I want to be able to use the search button on the static html page to search the search.php
page, is that possible?
Is this correct? This is located inside my test.html
:
<div class="search_bar-wrapper">
<input type="text" class="search_bar search-input evt-search-input-wp" placeholder="Search"
value="<?php echo get_search_query(true); ?>"/>
<button class="btn-fh btn-secondary search-btn search-btn-overlay">
<i class="custom-icon icon-icon_small_arrow_right"></i>
</button>
<div class="clearInput"><img src="/images/icon_close.svg" alt="" /></div>
</div>
Would I need to point a form="submit"
and action=".."
on the input instead? If so, what would the action need to point too?
So I have a .html page under my Wordpress website and I want to be able to use the search button on the static html page to search the search.php
page, is that possible?
Is this correct? This is located inside my test.html
:
<div class="search_bar-wrapper">
<input type="text" class="search_bar search-input evt-search-input-wp" placeholder="Search"
value="<?php echo get_search_query(true); ?>"/>
<button class="btn-fh btn-secondary search-btn search-btn-overlay">
<i class="custom-icon icon-icon_small_arrow_right"></i>
</button>
<div class="clearInput"><img src="/images/icon_close.svg" alt="" /></div>
</div>
Would I need to point a form="submit"
and action=".."
on the input instead? If so, what would the action need to point too?
1 Answer
Reset to default 2If you want to submit a form you need a <form>
element to contain the input. (You can get away without one but you'd need script to fake the submit.) The action is the homepage with the search text in an input named 's', e.g.
<form method="get" action="https://example/">
<input type="search" name="s" />
<input type="submit" value="Search" />
</form>
for a bare-bones form. Or you can use get_search_form()
to get a version with all of the ARIA attributes set up too.
本文标签: phpSearch WordPress using static html page
版权声明:本文标题:php - Search WordPress using static html page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741631908a2389415.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
search.php
doesn't actually perform a search, all the searching is done and finished long beforesearch.php
is loaded, it just displays the results afterwards. Infact you can have a theme with only anindex.php
template and search will still function – Tom J Nowell ♦ Commented Apr 6, 2021 at 16:39