Last active
July 2, 2025 13:58
-
-
Save jdevalk/5630481 to your computer and use it in GitHub Desktop.
Bits of schema that require non-schema filters right now, for which I've written these functions
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 | |
// To make the post thumbnail the image of the schema, for instance on http://yoast.com/speaks-at/ | |
function yoast_schema_post_thumbnail( $html ) { | |
return str_replace( '<img ', '<img itemprop="image" ', $html ); | |
} | |
add_filter( 'post_thumbnail_html', 'yoast_schema_post_thumbnail' ); |
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 | |
// For post URLs, for instance on http://yoast.com/speaks-at/ | |
function yoast_title_link_schema( $output ) { | |
return str_replace( 'rel="bookmark"', 'rel="bookmark" itemprop="url"', $output ); | |
} | |
add_filter( 'genesis_post_title_output', 'yoast_title_link_schema', 20 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment