Opened 7 months ago
#61551 new enhancement
Page template list lacks sorting
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 6.5.5 |
Component: | Editor | Keywords: | |
Focuses: | ui, administration | Cc: |
Description
This issue wont be apparent in the Page Block Editor (or classic editor) if your theme has no page templates or templates with similar names. I've created dummy template files that contained a number in their names. WP currently doesnt do any sorting which makes the template list look very disorganized. See attached images.
Solution:
Add the following snippet to the method 'get_post_templates' of class WP_Theme, right above "$this->cache_add( 'post_templates', $post_templates );"
Snippet:
<?php // Sort template names using "natural ordering" foreach ($post_templates as &$value ){ natsort($value); }
Attachments (2)
Note: See
TracTickets for help on using
tickets.
Problem solved with proposed snippet.