WordPress.org

Make WordPress Core

Ticket #24257: query.php.patch

File query.php.patch, 1.5 KB (added by alex-ye, 12 months ago)
  • query.php

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: \trunk\wp-includes
    # It uses platform neutral UTF-8 encoding and \n newlines.
    # Above lines and this line are ignored by the patching process.
     
    175175 * @since 2.0.0 
    176176 * @uses $wp_query 
    177177 * 
     178 * @param mixed $attachment Attachment ID, title, slug, or array of such. 
    178179 * @return bool 
    179180 */ 
    180 function is_attachment() { 
     181function is_attachment( $attachment = '' ) { 
    181182        global $wp_query; 
    182183 
    183184        if ( ! isset( $wp_query ) ) { 
     
    185186                return false; 
    186187        } 
    187188 
    188         return $wp_query->is_attachment(); 
     189        return $wp_query->is_attachment( $attachment ); 
    189190} 
    190191 
    191192/** 
     
    31083109         * 
    31093110         * @since 3.1.0 
    31103111         * 
     3112         * @param mixed $attachment Attachment ID, title, slug, or array of such.          
    31113113         * @return bool 
    31123114         */ 
    3113         function is_attachment() { 
    3114                 return (bool) $this->is_attachment; 
     3115        function is_attachment( $attachment = '' ) { 
     3116                if ( !$this->is_attachment ) 
     3117                        return false; 
     3118 
     3119                if ( empty( $attachment ) ) 
     3120                        return true; 
     3121 
     3122                $attachment = (array) $attachment; 
     3123 
     3124                $post_obj = $this->get_queried_object(); 
     3125 
     3126                if ( in_array( $post_obj->ID, $attachment ) ) 
     3127                        return true; 
     3128                elseif ( in_array( $post_obj->post_title, $attachment ) ) 
     3129                        return true; 
     3130                elseif ( in_array( $post_obj->post_name, $attachment ) ) 
     3131                        return true; 
     3132 
     3133                return false; 
    31153134        } 
    31163135 
    31173136        /**