Guest User

Untitled

a guest
Feb 20th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. function ap_sitelinks_search_box (){
  2. if ( is_front_page() ) {
  3. echo PHP_EOL . '<script type="application/ld+json">' . PHP_EOL;
  4. echo '{' . PHP_EOL;
  5. echo ' "@context": "http://schema.org",' . PHP_EOL;
  6. echo ' "@type": "WebSite",' . PHP_EOL;
  7. echo ' "url": "' . get_site_url() . '/",' . PHP_EOL;
  8. echo ' "potentialAction": {' . PHP_EOL;
  9. echo ' "@type": "SearchAction",' . PHP_EOL;
  10. echo ' "target": "' . get_home_url() . '/?s={search_term}",' . PHP_EOL;
  11. echo ' "query-input": "required name=search_term"' . PHP_EOL;
  12. echo ' }' . PHP_EOL;
  13. echo '}' . PHP_EOL;
  14. echo '</script>' . PHP_EOL;
  15. }
  16. }
  17. add_action( 'wp_footer', 'ap_sitelinks_search_box', 10000 );
Advertisement
Add Comment
Please, Sign In to add comment