{"id":18629,"date":"2012-06-17T17:16:08","date_gmt":"2012-06-17T17:16:08","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/twitter-cards\/"},"modified":"2013-04-03T05:10:50","modified_gmt":"2013-04-03T05:10:50","slug":"twitter-cards","status":"publish","type":"plugin","link":"https:\/\/lmo.wordpress.org\/plugins\/twitter-cards\/","author":41558,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0.5","stable_tag":"1.0.5","tested":"3.5.2","requires":"3.3","requires_php":"","requires_plugins":"","header_name":"Twitter Cards","header_author":"Niall Kennedy","header_description":"","assets_banners_color":"","last_updated":"2013-04-03 05:10:50","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/github.com\/niallkennedy\/twitter-cards","header_author_uri":"http:\/\/www.niallkennedy.com\/","rating":4.5,"author_block_rating":0,"active_installs":300,"downloads":21418,"num_ratings":2,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","faq","changelog"],"tags":[],"upgrade_notice":{"1.0.5":"<p>Allow cards of app, gallery, or product type.<\/p>","1.0.4":"<p>Treat post format of image as a Twitter photo card.<\/p>","1.0.3":"<p>Simplify description generator. Allow no description for photo cards.<\/p>","1.0.2":"<p>Change attribute from value to content to match current Twitter documentation.<\/p>","1.0.1":"<p>Improved auto-generated description.<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":"1","5":"1"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":"639468","resolution":"1","location":"assets"},"screenshot-2.png":{"filename":"screenshot-2.png","revision":"639468","resolution":"2","location":"assets"}},"screenshots":{"1":"Twitter Card display on desktop","2":"Twitter Card display on mobile"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[38125,159,2992],"plugin_category":[56],"plugin_contributors":[77856],"plugin_business_model":[],"class_list":["post-18629","plugin","type-plugin","status-publish","hentry","plugin_tags-semantic-markup","plugin_tags-twitter","plugin_tags-twitter-cards","plugin_category-social-and-sharing","plugin_contributors-niallkennedy","plugin_committers-niallkennedy"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/twitter-cards.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/twitter-cards\/assets\/screenshot-1.png?rev=639468","caption":"Twitter Card display on desktop"},{"src":"https:\/\/ps.w.org\/twitter-cards\/assets\/screenshot-2.png?rev=639468","caption":"Twitter Card display on mobile"}],"raw_content":"<!--section=description-->\n<p>Generate inline content previews on Twitter.com and Twitter clients by including <a href=\"https:\/\/dev.twitter.com\/docs\/cards\">Twitter Card<\/a> HTML meta elements for individual posts.<\/p>\n\n<p>All cards are a Twitter Card summary by default. Tap into the <code>twitter_card_properties<\/code> filter to reference the Twitter accounts of your site or author.<\/p>\n\n<p>Test your site's Twitter Card display through <a href=\"https:\/\/dev.twitter.com\/docs\/cards\/preview\">Twitter's card preview tool<\/a>.<\/p>\n\n<h3>Filters<\/h3>\n\n<ul>\n<li><code>twitter_cards_properties<\/code> - act on an array of properties before they are output to the page<\/li>\n<li><code>twitter_cards_htmlxml<\/code> - override the default treatment of <code>html<\/code> with <code>xml<\/code>. XML will self-close the meta void element ( \"\" vs. \"\" )<\/li>\n<\/ul>\n\n<!--section=faq-->\n<dl>\n<dt>Why don't you support feature X?<\/dt>\n<dd><p>I wrote this plugin for my own site, <a href=\"http:\/\/www.niallkennedy.com\/\" title=\"Niall Kennedy\">NiallKennedy.com<\/a>, added some slight flexibility through filters, and released the plugin on GitHub as <a href=\"https:\/\/github.com\/niallkennedy\/twitter-cards-php\" title=\"Twitter Cards generator PHP\">a PHP library<\/a> with <a href=\"https:\/\/github.com\/niallkennedy\/twitter-cards\" title=\"Twitter Cards WordPress plugin\">a WordPress plugin wrapper<\/a>. I use summary cards for my site'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.<\/p><\/dd>\n<dt>How do I add my Twitter account?<\/dt>\n<dd><p>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's <code>functions.php<\/code> file or create a new file in <code>wp-content\/mu-plugins\/twitter-cards.php<\/code> or something similar.<\/p>\n\n<pre><code>add_filter( 'twitter_cards_properties', 'twitter_custom' );\n<\/code><\/pre>\n\n<p>Next you need to modify the array passed to the filter with your own values.<\/p>\n\n<pre><code>function twitter_custom( $twitter_card ) {\n    if ( is_array( $twitter_card ) ) {\n        $twitter_card['creator'] = '@niall';\n        $twitter_card['creator:id'] = '1085';\n    }\n    return $twitter_card;\n}\n<\/code><\/pre>\n\n<p>The values generated by the plugin are passed to your new function for manipulation before output.<\/p>\n\n<p>The Twitter API function users\/show is a good way to lookup your account information. Copy the <code>screen_name<\/code> and <code>id_str<\/code> to <code>creator<\/code> and <code>creator:id<\/code> array values respectively in your filter function referenced above.\nhttps:\/\/api.twitter.com\/1\/users\/show.json?screen_name=niall<\/p>\n\n<p>Your 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.<\/p><\/dd>\n<dt>You forgot to include a trailing slash on meta elements<\/dt>\n<dd><p>The plugin outputs HTML-style void elements without a trailing slash by default. Add XML-style trailing slashes by returning a value of <code>xml<\/code> on the <code>twitter_cards_htmlxml<\/code> filter.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.5<\/h4>\n\n<ul>\n<li>Update Twitter Cards PHP library to support extending the plugin for new app, gallery, or product Twitter Card types.<\/li>\n<\/ul>\n\n<h4>1.0.4<\/h4>\n\n<ul>\n<li>Treat post format of \"image\" as a Twitter photo card.<\/li>\n<\/ul>\n\n<h4>1.0.3<\/h4>\n\n<ul>\n<li>Simplify the description generator. Based on the Open Graph protocol description generator in the Facebook plugin.<\/li>\n<li>Update bundled version of Twitter Cards PHP, fixing description property treated as a required property for photo card type.<\/li>\n<\/ul>\n\n<h4>1.0.2<\/h4>\n\n<ul>\n<li>Change attribute from value to content to match current Twitter documentation.<\/li>\n<\/ul>\n\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Improve automatic excerpt generator and scrubber<\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>Initial release<\/li>\n<\/ul>","raw_excerpt":"Add Twitter Card markup to individual posts. Supports summary, photo, and player types.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/18629","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=18629"}],"author":[{"embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/niallkennedy"}],"wp:attachment":[{"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=18629"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=18629"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=18629"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=18629"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=18629"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/lmo.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=18629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}