-1

我在 wordpress 前面有一个搜索,它需要替换为搜索我的画廊的第二个搜索。我试过弄乱代码但没有任何效果?

这是当前的搜索表单

<form method="get" id="searchbar" action="<?php echo home_url( '/' ); ?>">
<input type="search" name="s" placeholder="search...">
</form>

这是我需要的搜索

    <p class="search-box">
<label class="screen-reader-text" for="post-search-input">Search Gallery Posts:</label>
<input type="search" id="post-search-input" name="s" value=""/>
<input type="submit" name="" id="search-submit" class="button" value="Search Gallery Posts"/>
</p>
<input type="hidden" name="post_status" class="post_status_page" value="all"/>
<input type="hidden" name="post_type" class="post_type_page" value="gallery"/>
<input type="hidden" id="_wpnonce" name="_wpnonce" value="386bd8477b"/>
<input type="hidden" name="_wp_http_referer" value="/wp-admin/edit.php?post_type=gallery"/>
<div class="tablenav top">
<table class="wp-list-table widefat fixed posts" cellspacing="0">
<div class="tablenav bottom">
</form>
4

1 回答 1

0

看起来你应该替换你的代码:

<form method="get" id="searchbar" action="<?php echo home_url( '/' ); ?>">
    <input type="search" name="s" placeholder="search...">
</form>

有了这个:

<p class="search-box">
    <form method="get" id="searchbar" action="<?php echo home_url( '/' ); ?>">
        <label class="screen-reader-text" for="post-search-input">Search Gallery Posts:</label>
        <input type="search" id="post-search-input" name="s" value=""/>
        <input type="submit" name="" id="search-submit" class="button" value="Search Gallery Posts"/>
        <input type="hidden" name="post_status" class="post_status_page" value="all"/>
        <input type="hidden" name="post_type" class="post_type_page" value="gallery"/>
    </form>
</p>
于 2012-12-27T21:09:10.683 回答