WordPress.org

Make WordPress Core

Ticket #25879: 25879.patch

File 25879.patch, 1.2 KB (added by meloniq, 8 years ago)

Adds 'page_template_dropdown' filter

  • wp-admin/includes/template.php

     
    692692}
    693693
    694694/**
    695  * {@internal Missing Short Description}}
     695 * Print out <option> html elements for page templates
    696696 *
    697697 * @since 1.5.0
    698698 *
    699  * @param unknown_type $default
     699 * @param string $default (Optional) The template file name
    700700 */
    701701function page_template_dropdown( $default = '' ) {
    702702        $templates = get_page_templates();
     703        $templates = apply_filters( 'page_template_dropdown', $templates, $default );
    703704        ksort( $templates );
    704         foreach (array_keys( $templates ) as $template )
    705                 : if ( $default == $templates[$template] )
    706                         $selected = " selected='selected'";
    707                 else
    708                         $selected = '';
    709         echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";
    710         endforeach;
     705        foreach ( array_keys( $templates ) as $template ) {
     706                $selected = selected( $default, $templates[ $template ], false );
     707                echo "\n\t<option value='" . $templates[ $template ] . "' $selected>$template</option>";
     708        }
    711709}
    712710
    713711/**