summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/class.jetpack-twitter-cards.php')
-rw-r--r--plugins/jetpack/class.jetpack-twitter-cards.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/plugins/jetpack/class.jetpack-twitter-cards.php b/plugins/jetpack/class.jetpack-twitter-cards.php
index 87841867..17225928 100644
--- a/plugins/jetpack/class.jetpack-twitter-cards.php
+++ b/plugins/jetpack/class.jetpack-twitter-cards.php
@@ -36,9 +36,23 @@ class Jetpack_Twitter_Cards {
}
if ( ! is_singular() || ! empty( $og_tags['twitter:card'] ) ) {
+ /**
+ * Filter the default Twitter card image, used when no image can be found in a post.
+ *
+ * @module sharedaddy, publicize
+ *
+ * @since 5.9.0
+ *
+ * @param string $str Default image URL.
+ */
+ $image = apply_filters( 'jetpack_twitter_cards_image_default', '' );
+ if ( ! empty( $image ) ) {
+ $og_tags['twitter:image'] = $image;
+ }
+
return $og_tags;
}
-
+
$the_title = get_the_title();
if ( ! $the_title ) {
$the_title = get_bloginfo( 'name' );
@@ -114,6 +128,14 @@ class Jetpack_Twitter_Cards {
}
}
+ if ( empty( $og_tags['twitter:image'] ) && empty( $og_tags['twitter:image:src'] ) ) {
+ /** This action is documented in class.jetpack-twitter-cards.php */
+ $image = apply_filters( 'jetpack_twitter_cards_image_default', '' );
+ if ( ! empty( $image ) ) {
+ $og_tags['twitter:image'] = $image;
+ }
+ }
+
return $og_tags;
}