Make WordPress Core

Ticket #16784: 16784.diff

File 16784.diff, 1.5 KB (added by iamfriendly, 9 years ago)

Refreshed the patch

  • wp-includes/general-template.php

    diff --git wp-includes/general-template.php wp-includes/general-template.php
    index 48b8de9..25fb3f3 100644
    function post_type_archive_title( $prefix = '', $display = true ) { 
    10311031}
    10321032
    10331033/**
     1034 * Display or retrieve description for a post type archive.
     1035 *
     1036 * This is optimized for archive.php and archive-{$post_type}.php template files
     1037 * for displaying the description of the post type.
     1038 *
     1039 * @since 4.4.0
     1040 *
     1041 * @param bool $display Optional, default is true. Whether to display or retrieve description.
     1042 * @return string|null Description when retrieving, null when displaying or failure.
     1043 */
     1044function post_type_archive_description( $display = true ) {
     1045        if ( ! is_post_type_archive() ) {
     1046                return;
     1047        }
     1048
     1049        $post_type = get_query_var( 'post_type' );
     1050        if ( is_array( $post_type ) ) {
     1051                $post_type = reset( $post_type );
     1052        }
     1053
     1054        $post_type_obj = get_post_type_object( $post_type );
     1055        /**
     1056         * Filter the post type archive description.
     1057         *
     1058         * @since 4.4.0
     1059         *
     1060         * @param string $post_type_description Post type 'description' argument.
     1061         * @param string $post_type             Post type.
     1062         */
     1063        $description = apply_filters( 'post_type_archive_description', $post_type_obj->description, $post_type );
     1064
     1065        if ( $display ) {
     1066                echo $description;
     1067        } else {
     1068                return $description;
     1069        }
     1070}
     1071
     1072/**
    10341073 * Display or retrieve page title for category archive.
    10351074 *
    10361075 * This is useful for category template file or files, because it is optimized