WordPress.org

Make WordPress Core

Ticket #20156: post-template.multiselect_dropdown_pages.patch

File post-template.multiselect_dropdown_pages.patch, 885 bytes (added by jackreichert, 6 years ago)

patch adds multiple="multiple" to wp_dropdown_pages()

  • post-template.php

     
    774774                'selected' => 0, 'echo' => 1,
    775775                'name' => 'page_id', 'id' => '',
    776776                'show_option_none' => '', 'show_option_no_change' => '',
    777                 'option_none_value' => ''
     777                'option_none_value' => '',
     778                'multiselect' => false
    778779        );
    779780
    780781        $r = wp_parse_args( $args, $defaults );
     
    787788                $id = $name;
    788789
    789790        if ( ! empty($pages) ) {
    790                 $output = "<select name='" . esc_attr( $name ) . "' id='" . esc_attr( $id ) . "'>\n";
     791                $output = "<select name='" . esc_attr( $name ) . "'".(($multiselect) ? "multiple='multiple'" : "") ." id='" . esc_attr( $id ) . "'>\n";
    791792                if ( $show_option_no_change )
    792793                        $output .= "\t<option value=\"-1\">$show_option_no_change</option>";
    793794                if ( $show_option_none )