WordPress.org

Making WordPress.org

Changeset 7443


Ignore:
Timestamp:
07/12/2018 06:46:35 PM (7 months ago)
Author:
coffee2code
Message:

developer.wordpress.org: Add get_post_types_with_source_code() (and use it in post_type_has_source_code()).

File:
1 edited

Legend:

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

    r7269 r7443  
    12751275
    12761276    /**
     1277     * Returns the array of post types that have source code.
     1278     *
     1279     * @return array
     1280     */
     1281    function get_post_types_with_source_code() {
     1282        return array( 'wp-parser-class', 'wp-parser-method', 'wp-parser-function' );
     1283    }
     1284
     1285    /**
    12771286     * Does the post type have source code?
    12781287     *
     
    12821291     */
    12831292    function post_type_has_source_code( $post_type = null ) {
    1284         $post_type                   = $post_type ? $post_type : get_post_type();
    1285         $post_types_with_source_code = array( 'wp-parser-class', 'wp-parser-method', 'wp-parser-function' );
    1286 
    1287         return in_array( $post_type, $post_types_with_source_code );
     1293        $post_type = $post_type ? $post_type : get_post_type();
     1294
     1295        return in_array( $post_type, get_post_types_with_source_code() );
    12881296    }
    12891297
Note: See TracChangeset for help on using the changeset viewer.