Last active
April 19, 2019 21:57
-
-
Save LucaRosaldi/7321d09fd2b282ce92e5 to your computer and use it in GitHub Desktop.
WP: Search Form in Microdata Format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The search form in Microdata format. | |
* | |
* This is used by Google to display a fully functional | |
* search bar in the search results for your website, | |
* directly below the title. | |
* | |
* @link https://developers.google.com/webmasters/structured-data/slsb-overview | |
*/ | |
?> | |
<div itemscope itemtype="http://schema.org/WebSite"> | |
<meta itemprop="url" content="<?php echo home_url('/'); ?>"/> | |
<form class="search-form" method="get" action="<?php echo home_url('/'); ?>" role="search" itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction"> | |
<meta itemprop="target" content="<?php echo home_url('/'); ?>?s={s}"/> | |
<label class="search-form__label"><?php _e('Search'); ?></label> | |
<input class="search-form__input" type="text" name="s" itemprop="query-input" required/> | |
<input class="search-form__submit" type="submit"/> | |
</form> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment