WordPress.org

Make WordPress Core

Ticket #12398: template.php.diff

File template.php.diff, 990 bytes (added by studiograsshopper, 8 years ago)

Updated to deal with custom post types

  • template.php

     
    669669        if ( !in_array( $post_status, array('pending', 'draft', 'future') ) && ( empty($post_type) || post_type_supports($post_type, 'comments') ) )
    670670                $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></div>';
    671671        $posts_columns['date'] = __('Date');
    672         // @todo filter per type
    673         $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
     672       
     673        /* Filter type */
     674        if( $post_type == 'post' ) {
     675                $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
     676        } elseif( $post_type == 'page' ) {
     677                $posts_columns = apply_filters('manage_pages_columns', $posts_columns);
     678        } else {
     679                $posts_columns = apply_filters('manage_' . $post_type . '_columns', $posts_columns);
     680        }
    674681
    675682        return $posts_columns;
    676683}