Last active
June 1, 2023 01:18
-
-
Save temsool/acc678c254680e8536495c13e306678a to your computer and use it in GitHub Desktop.
schema agespace
This file contains 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 | |
add_filter( 'wpseo_schema_webpage', 'change_schema_ref', 11, 2 ); | |
function change_schema_ref( $piece ) { | |
$linkstring ='https://www.agespace.org'.$_SERVER['REQUEST_URI']; | |
$piece['@id']=$linkstring; | |
$piece['url']=$linkstring; | |
$piece['breadcrumb']['@id']=$linkstring; | |
return $piece; | |
} | |
add_filter( 'wpseo_schema_breadcrumb', 'replace_domain_name_to_breadcrumb_schema', 11, 2 ); | |
/** | |
* Replace domain name in the breadcrumb schema piece individually. | |
* | |
* | |
* @param array $piece Schema.org Breadcrumb data array. | |
* @return array Altered Schema.org Breadcrumb data array. | |
*/ | |
function replace_domain_name_to_breadcrumb_schema( $piece ) { | |
$linkstring ='https://www.agespace.org'.$_SERVER['REQUEST_URI']; | |
$piece['@id'] = $linkstring; | |
return $piece; | |
} | |
?> |
This file contains 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
{ | |
"@context": "https://schema.org", | |
"@graph": [ | |
{ | |
"@type": "CollectionPage", | |
"@id": "https://www.agespace.org/services/home-care/essex", | |
"url": "https://www.agespace.org/services/home-care/essex", | |
"name": "Home Care in Essex | Domiciliary & Live-in Care Services", | |
"isPartOf": { | |
"@id": "https://www.agespace.org/#website" | |
}, | |
"description": "Compare Essex home care agencies & providers in our trusted guide. Domiciliary care, live-in care & specialist Dementia care in Essex", | |
"breadcrumb": { | |
"@id": "https://www.agespace.org/services/home-care/essex" | |
}, | |
"inLanguage": "en-GB" | |
}, | |
{ | |
"@type": "BreadcrumbList", | |
"@id": "https://www.agespace.org/services/home-care/essex", | |
"itemListElement": [ | |
{ | |
"@type": "ListItem", | |
"position": 1, | |
"name": "Home", | |
"item": "https://www.agespace.org/" | |
}, | |
{ | |
"@type": "ListItem", | |
"position": 2, | |
"name": "Essex" | |
} | |
] | |
}, | |
{ | |
"@type": "WebSite", | |
"@id": "https://www.agespace.org/#website", | |
"url": "https://www.agespace.org/", | |
"name": "Age Space", | |
"description": "sharing advice on elderly care", | |
"potentialAction": [ | |
{ | |
"@type": "SearchAction", | |
"target": { | |
"@type": "EntryPoint", | |
"urlTemplate": "https://www.agespace.org/?s={search_term_string}" | |
}, | |
"query-input": "required name=search_term_string" | |
} | |
], | |
"inLanguage": "en-GB" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment