Created
November 6, 2013 12:26
-
-
Save felixarntz/7335262 to your computer and use it in GitHub Desktop.
http://leaves-and-love.net/how-to-improve-wordpress-seo-with-schema-org/ (only works with WordPress SEO versions 1.7.1 and older!)
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 | |
function yourtheme_meta_schema() | |
{ | |
if( class_exists( 'WPSEO_Frontend' ) ) | |
{ | |
global $wpseo_front; | |
$canonical = $wpseo_front->canonical( false ); | |
echo '<link itemprop="url" href="' . esc_url( $canonical, null, 'other' ) . '" />' . "\n"; | |
$metadesc = $wpseo_front->metadesc( false ); | |
echo '<meta itemprop="description" content="' . esc_attr( strip_tags( stripslashes( $metadesc ) ) ) . '" />' . "\n"; | |
} | |
} | |
add_action( 'wp_head', 'yourtheme_meta_schema' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment