Created
August 30, 2019 09:11
-
-
Save Nikschavan/e7e5017627d7cc37d15c395b94eaedaf to your computer and use it in GitHub Desktop.
Remove CreativeWork schema from Astra Theme
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 // don't add this line to your file. | |
add_filter( 'astra_schema_body', '__return_empty_string' ); | |
add_filter( | |
'astra_attr_post-meta-author', | |
function( $attr ) { | |
unset( $attr['itemprop'] ); | |
unset( $attr['itemscope'] ); | |
unset( $attr['itemtype'] ); | |
$attr['class'] = 'posted-by author'; | |
return $attr; | |
} | |
); | |
add_filter( | |
'astra_attr_commen-meta-author', | |
function( $attr ) { | |
$attr['class'] = str_replace( 'vcard ', '', $attr['class'] ); | |
return $attr; | |
} | |
); | |
// Remove userinteraction schema from post comment meta. | |
add_filter( 'astra_attr_comments-interactioncounter', '__return_empty_array' ); | |
add_filter( 'astra_attr_comments-interactioncounter-interactiontype', '__return_empty_array' ); | |
add_filter( 'astra_attr_comments-interactioncounter-userinteractioncount', '__return_empty_array' ); | |
/** | |
* Remove CreativeWork schema. | |
* | |
* @param Array $attr markup HTML attributes. | |
* @return Array | |
*/ | |
function astra_child_remove_creative_work_schema( $attr ) { | |
unset( $attr['itemscope'] ); | |
unset( $attr['itemtype'] ); | |
return $attr; | |
} | |
add_filter( 'astra_attr_article-blog', 'astra_child_remove_creative_work_schema' ); | |
add_filter( 'astra_attr_article-page', 'astra_child_remove_creative_work_schema' ); | |
add_filter( 'astra_attr_article-single', 'astra_child_remove_creative_work_schema' ); | |
add_filter( 'astra_attr_article-content', 'astra_child_remove_creative_work_schema' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment