Created
April 19, 2015 23:00
-
-
Save ericakfranz/56c9964f5eebda8352ba to your computer and use it in GitHub Desktop.
Filter WP SEO's OpenGraph and Twitter image meta tags
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 | |
/** | |
* Return 'medium' image for mobile devices since that is what we're | |
* loading to display as the featured image on each post. | |
*/ | |
//* Filter WP SEO's OpenGraph image output | |
add_filter('wpseo_opengraph_image_size', 'disi_opengraph_image_size'); | |
function disi_opengraph_image_size($val) { | |
if( wp_is_mobile() ) { | |
return 'medium'; | |
} else { | |
return 'large'; | |
} | |
} | |
//* Filter WP SEO's Twitter Card image output | |
add_filter( 'wpseo_twitter_image_size', 'disi_custom_twitter_image_size'); | |
function disi_custom_twitter_image_size( $img_size ) { | |
if( wp_is_mobile() ) { | |
return 'medium'; | |
} else { | |
return 'large'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment