Àpèjúwe
Generate inline content previews on Twitter.com and Twitter clients by including Twitter Card HTML meta elements for individual posts.
All cards are a Twitter Card summary by default. Tap into the twitter_card_properties filter to reference the Twitter accounts of your site or author.
Test your siteÌtumọ̀ Yorùbá: ’s Twitter Card display through TwitterÌtumọ̀ Yorùbá: ’s card preview tool.
Filters
twitter_cards_propertiesÌtumọ̀ Yorùbá: – act on an array of properties before they are output to the pagetwitter_cards_htmlxmlÌtumọ̀ Yorùbá: – override the default treatment ofhtmlwithxml. XML will self-close the meta void element ( “” vs. “” )
FAQ
- Why donÌtumọ̀ Yorùbá: ’t you support feature X?
-
I wrote this plugin for my own site, NiallKennedy.com, added some slight flexibility through filters, and released the plugin on GitHub as a PHP library with a WordPress plugin wrapper. I use summary cards for my siteÌtumọ̀ Yorùbá: ’s articles. If you would like to add better support for photos, galleries, videos, apps, or products exposed to Twitter you can fork my work and optionally send some code in a pull request.
- How do I add my Twitter account?
-
First you need to hook into the filter from code in your theme or site plugin(s). You can add this code to your themeÌtumọ̀ Yorùbá: ’s
functions.phpfile or create a new file inwp-content/mu-plugins/twitter-cards.phpor something similar.add_filter( 'twitter_cards_properties', 'twitter_custom' );Next you need to modify the array passed to the filter with your own values.
function twitter_custom( $twitter_card ) { if ( is_array( $twitter_card ) ) { $twitter_card['creator'] = '@niall'; $twitter_card['creator:id'] = '1085'; } return $twitter_card; }The values generated by the plugin are passed to your new function for manipulation before output.
The Twitter API function users/show is a good way to lookup your account information. Copy the
screen_nameandid_strtocreatorandcreator:idarray values respectively in your filter function referenced above.
https://api.twitter.com/1/users/show.json?screen_name=niallYour Twitter screenname may change but your Twitter ID will remain the same. Grab both while you are setting up your site to provide Twitter with the best data.
- You forgot to include a trailing slash on meta elements
-
The plugin outputs HTML-style void elements without a trailing slash by default. Add XML-style trailing slashes by returning a value of
xmlon thetwitter_cards_htmlxmlfilter.
Àwọn àgbéyẹ̀wò
Kò sí àwọn àgbéyẹ̀wò fún plugin yìí.
Àwọn Olùkópa & Olùgbéejáde
“Twitter Cards” jẹ́ ètò ìṣàmúlò orísun ṣíṣí sílẹ̀. Àwọn ènìyàn wọ̀nyí ti ṣe ìkópa sí plugin yìí.
Àwọn OlùkópaTúmọ̀ “Twitter Cards” sí èdè rẹ.
Ṣe o nífẹ̀ẹ́ sí ìdàgbàsókè?
Ṣàwárí koodu, ṣàyẹ̀wò ibi ìpamọ́ SVN, tàbí ṣe àgbékalẹ̀ sí àkọsílẹ̀ ìdàgbàsókè nípasẹ̀ RSS.
Àkọsílẹ̀ àwọn àyípadà
1.0.5
- Update Twitter Cards PHP library to support extending the plugin for new app, gallery, or product Twitter Card types.
1.0.4
- Treat post format of “image” as a Twitter photo card.
1.0.3
- Simplify the description generator. Based on the Open Graph protocol description generator in the Facebook plugin.
- Update bundled version of Twitter Cards PHP, fixing description property treated as a required property for photo card type.
1.0.2
- Change attribute from value to content to match current Twitter documentation.
1.0.1
- Improve automatic excerpt generator and scrubber
1.0
- Initial release

