Skip to content

Instantly share code, notes, and snippets.

@jdevalk
Last active July 2, 2025 13:58
Show Gist options
  • Save jdevalk/5630481 to your computer and use it in GitHub Desktop.
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
<?php
// For pages where you'd rather not have 20 rel=authors and in fact *do* need itemprop=author
// For instance on http://yoast.com/review/
function yoast_author_schema( $output ) {
return str_replace( 'rel="author"', 'itemprop="author"', $output );
}
add_filter( 'genesis_post_author_posts_link_shortcode', 'yoast_author_schema', 20 );
<?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' );
<?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