2013-03-28 2 views
0

내 WP에 표준 검색 양식이 있습니다.Wordpress 검색 사용자 정의 양식

<form method="get" id="searchform" action="<?php echo esc_url(home_url('/')); ?>"> 
    <label for="s" class="assistive-text"><?php _e('Search', 'twentyeleven'); ?></label> 
    <input type="text" class="field" name="s" id="s" placeholder="<?php esc_attr_e('Search', 'twentyeleven'); ?>" /> 
    <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e('Search', 'twentyeleven'); ?>" /> 
</form> 

어떻게하면됩니까?

답변

0

테마 폴더에 searchform.php을 만들면됩니다. 표준 코드에서 php-tags를 복사하면 비슷한 동작을 얻을 수 있습니다. 또한 이름 속성을 변경하지 마십시오. 그렇지 않으면 작동하지 않습니다.

<form role="search" method="get" id="searchform" action="<?php echo home_url('/'); ?>"> 
    <div><label class="screen-reader-text" for="s">Search for:</label> 
    <input type="text" value="" name="s" id="s" /> 
    <input type="submit" id="searchsubmit" value="Search" /> 
    </div> 
</form> 

Codex page

+0

의 예를 참조하십시오 나는이 두 번 복사해야합니까? 검색 위젯이 있는데 여전히 2 개의 필드를 볼 수 없습니다. Adam

관련 문제