简体   繁体   中英

Using a static HTML page to access WordPress search

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 WordPress using the native 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?

Yes You Can did by add this code in your html page and Change Form Action Url With Your Wordpress Url

<div class="search_bar-wrapper">
    <form action="https://wordpressdomainhere.com/" method="get">
        <input type="text" name="s" class="search_bar search-input evt-search-input-wp" placeholder="Search Here"/>
        <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>
    </form>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM