WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/08/2014 04:18:30 AM (7 years ago)
Author:
nacin
Message:

Rename the new page_templates filter to theme_page_templates, and pass it a post object for proper context.

see #13265.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme.php

    r27297 r27470  
    932932     * @access public
    933933     *
     934     * @param WP_Post|null $post Optional. The post being edited, provided for context.
    934935     * @return array Array of page templates, keyed by filename, with the value of the translated header name.
    935936     */
    936     public function get_page_templates() {
     937    public function get_page_templates( $post = null ) {
    937938        // If you screw up your current theme and we invalidate your parent, most things still work. Let it slide.
    938939        if ( $this->errors() && $this->errors()->get_error_codes() !== array( 'theme_parent_invalid' ) )
     
    962963
    963964        if ( $this->parent() )
    964             $page_templates += $this->parent()->get_page_templates();
     965            $page_templates += $this->parent()->get_page_templates( $post );
    965966
    966967        /**
     
    971972         * @since 3.9.0
    972973         *
    973          * @param array    $page_templates Array of page templates. Keys are filenames,
    974          *                                 values are translated names.
    975          * @param WP_Theme $this           The theme object.
     974         * @param array        $page_templates Array of page templates. Keys are filenames,
     975         *                                     values are translated names.
     976         * @param WP_Theme     $this           The theme object.
     977         * @param WP_Post|null $post           The post being edited, provided for context, or null.
    976978         */
    977         $return = apply_filters( 'page_templates', $page_templates, $this );
     979        error_log( serialize( $this ) );
     980        $return = apply_filters( 'theme_page_templates', $page_templates, $this, $post );
    978981        return array_intersect_assoc( $return, $page_templates );
    979982    }
Note: See TracChangeset for help on using the changeset viewer.