Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ap_sitelinks_search_box (){
- if ( is_front_page() ) {
- echo PHP_EOL . '<script type="application/ld+json">' . PHP_EOL;
- echo '{' . PHP_EOL;
- echo ' "@context": "http://schema.org",' . PHP_EOL;
- echo ' "@type": "WebSite",' . PHP_EOL;
- echo ' "url": "' . get_site_url() . '/",' . PHP_EOL;
- echo ' "potentialAction": {' . PHP_EOL;
- echo ' "@type": "SearchAction",' . PHP_EOL;
- echo ' "target": "' . get_home_url() . '/?s={search_term}",' . PHP_EOL;
- echo ' "query-input": "required name=search_term"' . PHP_EOL;
- echo ' }' . PHP_EOL;
- echo '}' . PHP_EOL;
- echo '</script>' . PHP_EOL;
- }
- }
- add_action( 'wp_footer', 'ap_sitelinks_search_box', 10000 );
Advertisement
Add Comment
Please, Sign In to add comment