Jetpack automatically sets the Card type depending on your post:
- If you use the Image Post Format, the Card type will be set to
photo
and will create a Image meta tag using the Featured Image if it’s large enough (at least 240x240px).
- If you only inserted one image into your post, and if your post content includes 2 paragraphs of text or less, the Card type will also be set to
photo
and Jetpack will create an image meta tag using that image.
- In other cases (if you have more than one image, if your post content includes more than 2 paragraphs, if you don’t use the Image Post Format), the Card type will be set to
summary_large_image
, summary
, or gallery
depending on the case.
If, however, you’d like to overwrite the default Jetpack behaviour and set your own Card Types, you can use the jetpack_open_graph_tags
filter, like so:
function tweakjp_custom_twitter_site( $og_tags ) {
????$og_tags['twitter:card'] = 'photo';
????return $og_tags;
}
add_filter( 'jetpack_open_graph_tags', 'tweakjp_custom_twitter_site', 11 );
In this example, all posts will start using the photo
type, but you’re welcome to add conditionals as you see fit!
You can place that code in your theme’s functions.php file, or in a functionality plugin.
I hope this helps.