Created
January 11, 2017 13:37
-
-
Save webdados/9e06f696b828bb9947cabc7664ccf601 to your computer and use it in GitHub Desktop.
Use WordPress post excerpt as Facebook Instant Article subtitle
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 | |
/* Instant Articles (https://wordpress.org/plugins/fb-instant-articles/) - Use post excerpt as subtitle */ | |
add_filter( 'instant_articles_subtitle', 'hf_instant_articles_subtitle' ); | |
function hf_instant_articles_subtitle( $subtitle ) { | |
$excerpt = get_the_excerpt(); | |
if ( trim($excerpt)!='' ) $subtitle = trim($excerpt); | |
return $subtitle; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment