| | 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 | $plugin = get_post( $post_id ); |
| | 540 | $banner = Template::get_plugin_banner( $plugin, 'raw' ); |
| | 541 | if ( ! isset ( $banner['banner_2x'] ) ) { |
| | 542 | $banner['banner_2x'] = isset( $banner['banner'] ) ? $banner['banner'] : false; |
| | 543 | } |
| | 544 | $icon = Template::get_plugin_icon( $plugin, 'raw' ); |
| | 545 | if ( ! isset ( $icon['icon_2x'] ) ) { |
| | 546 | $icon['icon_2x'] = isset( $icon['icon'] ) ? $icon['icon'] : false; |
| | 547 | } |
| | 548 | |
| | 549 | printf( '<meta property="og:title" content="%s" />', esc_attr( get_the_title( $post_id ) ) ); |
| | 550 | printf( '<meta property="og:description" content="%s" />', esc_attr( get_the_excerpt( $post_id ) ) ); |
| | 551 | printf( '<meta property="og:site_name" content="WordPress.org" />' ); |
| | 552 | printf( '<meta property="og:type" content="website" />' ); |
| | 553 | printf( '<meta property="og:url" content="%s" />', esc_url( get_permalink( $post_id ) ) ); |
| | 554 | printf( '<meta name="twitter:card" content="summary_large_image">' ); |
| | 555 | printf( '<meta name="twitter:site" content="@WordPress">' ); |
| | 556 | if ( $banner['banner_2x'] ) { |
| | 557 | printf( '<meta name="twitter:image" content="%s" />', esc_url( $banner['banner_2x'] ) ); |
| | 558 | } |
| | 559 | if ( isset( $banner['banner'] ) ) { |
| | 560 | printf( '<meta property="og:image" content="%s" />', esc_url( $banner['banner'] ) ); |
| | 561 | } |
| | 562 | if ( $icon['icon_2x'] ) { |
| | 563 | printf( '<meta name="thumbnail" content="%s" />', esc_url( $icon['icon_2x'] ) ); |
| | 564 | } |
| | 565 | } |
| | 566 | |
| | 567 | /** |