| | 531 | * Output social metadata |
| | 532 | */ |
| | 533 | public function social_meta_data() { |
| | 534 | if ( ! is_singular( 'plugin' ) ) { |
| | 535 | return; |
| | 536 | } |
| | 537 | |
| | 538 | $post_id = get_the_ID(); |
| | 539 | $banner = Template::get_plugin_banner( $post_id, 'raw' ); |
| | 540 | if ( ! isset ( $banner['banner_2x'] ) ) { |
| | 541 | $banner['banner_2x'] = isset( $banner['banner'] ) ? $banner['banner'] : false; |
| | 542 | } |
| | 543 | $icon = Template::get_plugin_icon( $post_id, 'raw' ); |
| | 544 | if ( ! isset ( $icon['icon_2x'] ) ) { |
| | 545 | $icon['icon_2x'] = isset( $icon['icon'] ) ? $icon['icon'] : false; |
| | 546 | } |
| | 547 | |
| | 548 | printf( '<meta property="og:title" content="%s" />', get_the_title( $post_id ) ); |
| | 549 | printf( '<meta property="og:description" content="%s" />', get_the_excerpt( $post_id ) ); |
| | 550 | printf( '<meta property="og:site_name" content="WordPress.org" />' ); |
| | 551 | printf( '<meta property="og:type" content="website" />' ); |
| | 552 | printf( '<meta property="og:url" content="%s" />', esc_url( get_permalink( $post_id ) ) ); |
| | 553 | printf( '<meta name="twitter:card" content="summary_large_image">' ); |
| | 554 | printf( '<meta name="twitter:site" content="@WordPress">' ); |
| | 555 | if ( $banner['banner_2x'] ) { |
| | 556 | printf( '<meta name="twitter:image" content="%s" />', $banner['banner_2x'] ); |
| | 557 | } |
| | 558 | if ( isset( $banner['banner'] ) ) { |
| | 559 | printf( '<meta property="og:image" content="%s" />', $banner['banner'] ); |
| | 560 | } |
| | 561 | if ( $icon['icon_2x'] ) { |
| | 562 | printf( '<meta name="thumbnail" content="%s" />', $icon['icon_2x'] ); |
| | 563 | } |
| | 564 | } |
| | 565 | |
| | 566 | /** |