Making WordPress.org


Ignore:
Timestamp:
10/29/2014 08:07:38 PM (10 years ago)
Author:
coffee2code
Message:

Code Reference: override default handbook configuration (and other affected areas) to make the canonical post type slug plural

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/handbooks.php

    r953 r954  
    3838
    3939        add_filter( 'the_content', array( __CLASS__, 'autolink_credits' ) );
     40
     41        add_filter( 'handbook_post_type_defaults', array( __CLASS__, 'filter_handbook_post_type_defaults' ), 10, 2 );
    4042
    4143        // Add the handbook's 'Watch' action link.
     
    116118
    117119    /**
     120     * Overrides default handbook post type configuration.
     121     *
     122     * Specifically, uses a plural slug while retaining pre-existing singular post
     123     * type name.
     124     *
     125     * @access public
     126     *
     127     * @param  array  $defaults  The default post type configuration.
     128     * @param  string $post_type The post type name.
     129     * @return array
     130     */
     131    public static function filter_handbook_post_type_defaults( $defaults, $post_type ) {
     132        $defaults['rewrite'] = array(
     133            'feeds'      => false,
     134            'slug'       => $post_type . 's',
     135            'with_front' => false,
     136        );
     137
     138        return $defaults;
     139    }
     140
     141    /**
    118142     * For specific credit pages, link @usernames references to their profiles on
    119143     * profiles.wordpress.org.
Note: See TracChangeset for help on using the changeset viewer.