Making WordPress.org

Ticket #2864: meta_description.patch

File meta_description.patch, 1.6 KB (added by joostdevalk, 5 years ago)

meta description

  • wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    diff --git wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
    index 8f37a33f..91504317 100644
    class Plugin_Directory { 
    4343                add_filter( 'single_term_title', array( $this, 'filter_single_term_title' ) );
    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
    4748                // Cron tasks.
    4849                new Jobs\Manager();
  • wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    diff --git wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
    index 96cda8c7..5c782c7b 100644
    class Template { 
    119119        }
    120120
    121121        /**
     122         * Prints markup information in the head of a page.
     123     */
     124        public static function meta_description() {
     125                if ( is_singular( 'plugin' ) ) :
     126            $desc = esc_attr( get_the_excerpt( get_queried_object() ) );
     127                    printf( '<meta name="description" value="%s"/>', $desc );
     128        endif;
     129    }
     130
     131        /**
    122132         * Returns a string representing the number of active installs for an item.
    123133         *
    124134         * @static