2012-12-27 182 views
-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> 

回答

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>