Skip to content

List the active theme first and sort the rest by name as WordPress does #509

Open

Description

@SirLouen

What

The Themes screen shows themes in the order internal/themehost/library.go sorts them, which is by their bytes. For themes named alba, Álvaro, Zoe, theme2 and theme10 it shows Zoe, alba, theme10, theme2, Álvaro, and the active theme keeps its place in that order. WordPress shows the active theme first, then alba, theme2, theme10, Zoe, Álvaro.

  • Put the active theme first in Manager.List in internal/themehost/manager.go.
  • Sort the other names with case ignored and numbers in natural order, as PHP strnatcasecmp does.

Why

WordPress builds the themes screen with wp_prepare_themes_for_js, which keeps the active theme on top and sorts the rest with WP_Theme::sort_by_name. So a capital letter or a number does not move a theme out of place.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions