WordPress.org

Making WordPress.org

Changeset 5718


Ignore:
Timestamp:
07/26/2017 01:28:26 AM (4 years ago)
Author:
tellyworth
Message:

Plugin directory: add meta description on plugin pages. Props @joostdevalk

Fixes #2864

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r5698 r5718  
    4444        add_filter( 'the_content', array( $this, 'filter_rel_nofollow' ) );
    4545        add_action( 'wp_head', array( Template::class, 'json_ld_schema' ), 1 );
     46        add_action( 'wp_head', array( Template::class, 'meta_description' ), 1 );
    4647        add_action( 'wp_head', array( Template::class, 'hreflang_link_attributes' ), 2 );
    4748
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    r5604 r5718  
    120120
    121121    /**
     122     * Prints meta description in the head of a page.
     123     *
     124     * @static
     125     */
     126    public static function meta_description() {
     127        if ( is_singular( 'plugin' ) ) {
     128            printf( '<meta name="description" value="%s"/>',
     129                esc_attr( get_the_excerpt( get_queried_object() ) )
     130            );
     131        }
     132    }
     133
     134    /**
    122135     * Returns a string representing the number of active installs for an item.
    123136     *
Note: See TracChangeset for help on using the changeset viewer.