5

I've been searching for a hook to change the order in which themes are displayed in the admin panel (i.e. wp-admin/themes.php) but so far haven't been successful.

Is there an existing hook to do this, or another workaround so I can have a custom non-alphabetical ordering - i.e. have certain themes display before the rest?

3

The get_themes function passes the available themes to the theme list table class and is hardcoded with a call to asort the array, with no filters available anywhere along the way that i can see.

So in short, not possible at present due to an absence of hooks(at least as far as my observations go).

Relevant files:
http://core.trac.wordpress.org/browser/tags/3.2.1/wp-admin/includes/theme.php
http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/theme.php
http://core.trac.wordpress.org/browser/tags/3.2.1/wp-admin/includes/class-wp-themes-list-table.php

  • Thanks, this is what I was dreading - would it be possible/practical to extend the core and add a custom hook to the get_themes function? – Adam Dec 12 '11 at 15:28
  • Add a custom hook how? Short of modifying core files, i can't see how you could, else i'd have suggested it. :) – t31os Dec 12 '11 at 16:16
  • Yep, I'd have to modify the core file wp-includes/theme.php – Adam Dec 12 '11 at 16:18
  • Sure you could do that, it's just not one of those things we tend to recommend(because you're going to lose those mods with each update, and it's important to keep WP upto date). – t31os Dec 12 '11 at 16:21
  • Ok, thanks for the help, I'll possibly do this as a short-term measure and hope that WP add a hook in the future! – Adam Dec 12 '11 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.