WordPress.org

Make WordPress Core

Ticket #3752: 3752.diff

File 3752.diff, 980 bytes (added by rob1n, 11 years ago)

Cut it off at 80 characters (modifiable by a filter) and add a ... to the end (in HTML entities).

  • wp-admin/admin-functions.php

     
    12801280        $items = $wpdb->get_results( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order" );
    12811281
    12821282        if ( $items ) {
     1283                $max_title_length = (int) apply_filters('parent_dropdown_max_title_length', 80);
    12831284                foreach ( $items as $item ) {
    12841285                        // A page cannot be its own parent.
    12851286                        if (!empty ( $post_ID ) ) {
     
    12921293                                $current = ' selected="selected"';
    12931294                        else
    12941295                                $current = '';
     1296                       
     1297                        if (strlen($item->post_title) > $max_title_length) {
     1298                                $item->post_title = substr($item->post_title, 0, $max_title_length - 3) . '&8230;';
     1299                        }
    12951300
    12961301                        echo "\n\t<option value='$item->ID'$current>$pad $item->post_title</option>";
    12971302                        parent_dropdown( $default, $item->ID, $level +1 );