Make WordPress Core

Ticket #21758: comment-template.php.patch

File comment-template.php.patch, 1.8 KB (added by mattonomics, 12 years ago)
  • comment-template.php

     
    846846 *
    847847 * @param string $file Optional, default '/comments.php'. The file to load
    848848 * @param bool $separate_comments Optional, whether to separate the comments by comment type. Default is false.
     849 * @param bool $require Optional, whether to include a comment file. Default is true.
    849850 * @return null Returns null if no comments appear
    850851 */
    851 function comments_template( $file = '/comments.php', $separate_comments = false ) {
     852function comments_template( $file = '/comments.php', $separate_comments = false, $require = true ) {
    852853        global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;
    853854
    854855        if ( !(is_single() || is_page() || $withcomments) || empty($post) )
    855856                return;
    856857
    857         if ( empty($file) )
    858                 $file = '/comments.php';
    859 
    860858        $req = get_option('require_name_email');
    861859
    862860        /**
     
    909907
    910908        if ( !defined('COMMENTS_TEMPLATE') )
    911909                define('COMMENTS_TEMPLATE', true);
    912 
    913         $include = apply_filters('comments_template', STYLESHEETPATH . $file );
    914         if ( file_exists( $include ) )
    915                 require( $include );
    916         elseif ( file_exists( TEMPLATEPATH . $file ) )
    917                 require( TEMPLATEPATH . $file );
    918         else // Backward compat code will be removed in a future release
    919                 require( ABSPATH . WPINC . '/theme-compat/comments.php');
     910       
     911        // require a comments.php file?
     912        if ( $require !== false) {
     913                if ( empty($file) )
     914                        $file = '/comments.php';
     915                $include = apply_filters('comments_template', STYLESHEETPATH . $file );
     916                if ( file_exists( $include ) )
     917                        require( $include );
     918                elseif ( file_exists( TEMPLATEPATH . $file ) )
     919                        require( TEMPLATEPATH . $file );
     920                else // Backward compat code will be removed in a future release
     921                        require( ABSPATH . WPINC . '/theme-compat/comments.php');
     922        }
    920923}
    921924
    922925/**