Wordpress 検索フォーム
<form action="<?php echo home_url('/'); ?>" method="get" class="searchform">
<input type="text" value="<?php the_search_query(); ?>" name="s" id="s" placeholder="サイト内検索">
<input type="submit" id="searchSubmit" value="">
</form>
- ・form action => トップページURL
- ・method => get
- ・input value => <?php the_search_query(); ?>
- ・input id => s
searchform.php テンプレートファイル化
<?php get_search_form() ?> // テンプレートファイル呼び出し