Hi,
I don’t want to display code in any page and other post, just i want to display in Home page.
So i put code in “google site link search box” above the <head> tag
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "http://career.guru99.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "http://career.guru99.com/search?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
Hey kriru,
Ok, thanks for that. I’m not sure what problem you are having though?
Best regards,
Rikard
Hi
I have put code in “google site link search box” above the <head> tag.
I want to display code only single page. (Only Display Home Page)
Hi!
Please use the is_page or is_front_page conditional function.
// https://developer.wordpress.org/reference/functions/is_page/
// https://codex.wordpress.org/Function_Reference/is_front_page\
Or remove the code from the header.php file then add this in the functions.php file.
add_action('wp_head', 'wp_head_mod_gs');
function wp_head_mod_gs() {
if(is_front_page()) {
?>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "http://career.guru99.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "http://career.guru99.com/search?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
<?php
}
}
Regards,
Ismael