Aaron Jorbin just released a script called the “WordPress Theme Directory Slurper“, a command line PHP script which downloads the latest stable version of every theme in the WordPress.org theme repository. You can find more information about it in the GitHub repository.
I had a number of questions about the themes on WordPress.org, so I ran the script this morning a slurped all the themes. It took 112 minutes to run and downloaded nearly 4GB of theme code. Here’s what I found out.
How many themes are on WordPress.org?
How many themes are based on Underscores?
Underscores is a popular WordPress starter theme. Automattic uses it for the majority of their released themes, and it was also used as the base for TwentyFourteen and TwentyFifteen. I was curious how many themes in the repository were based on Underscores or a derivitive of it.
Answer: Between 534 and 565 themes (16.75% to 17.72% of the total).
Methodology: I searched for a function I believe to be unique to Underscores based themes. “_s_category_transient_flusher” flushes a specific transient when a category is edited or new post saved (which was found in 565 themes). There’s also a unique code comment in that function, “Like, beat it. Dig?”, which was in 534 themes.
grep -l -r --include '*.php' "category_transient_flusher()" .
grep -l -r --include '*.php' "Like, beat it. Dig?" .
How many themes have “lite” in their name?
Answer: 140 (4.39%)
How many themes use the latest WordPress functions?
- the_archive_title: 364 (11.42%)
- title-tag support: 73 (2.29%)
Methodology: The majority of themes have an archive.php template, so I searched for “the_archive_title” in that file:
grep -r --include="archive.php" "the_archive_title" .
For the title tag, I just did a straight grep:
grep -r --include '*.php' "add_theme_support( 'title-tag' )" .
For both I also did a manual check of the output afterwards for duplicates.
How many themes support the customizer?
The Theme Review Team now requires all theme options to be implemented through the Customizer. I wanted to see how many different theme actually added at least one control using “$wp_customize->add_control”.
Answer: 761 (23.8%)
Methodology: I searched for the string “$wp_customize->add_control” and returned the name of the file that had a match:
grep -l -r --include '*.php' "wp_customize->add_control" .
I also did a manual cleanup afterwards of duplicates.
How many themes add an options page?
Answer: 1585 (49.73%)
Methodology: Theme pages are added using the “add_theme_page” function. This doesn’t garauntee the pages is used for options (it could just be a documentation page), but it gives us a pretty good idea. After my first search I realized a popular library “TGM Activation” also included the “add_theme_page” function, so I excluded that from the search:
grep -l -r --include '*.php' --exclude="class-tgm-plugin-activation.php" "add_theme_page" .
How many themes use a bundled options framework?
There are a number of libraries that assist developers in adding theme options. I searched for a couple of the popular ones.
- Options Framework: 219 (6.87%)
- Redux: 25 (0.78%)
Methodology: I searched for the the strings “optionsframework_init” and “ReduxFrameworkPlugin::instance”, then manually checked for duplicates. I also checked for Titan Framework, but there were less than 5. Some frameworks (like OptionsTree) are only used as a plugin.
How many themes use TGM Activation?
TGM Activation is a popular library that allows theme developers to require or suggest certain plugins be installed along with the theme.
Answer: 187 (5.86%)
Methodology: I just searched for the filename of the library:
find . -name "class-tgm-plugin-activation.php"
There were a few other items I was curious about. How many themes use Twitter Bootstrap or Font Awesome? How many themes add a shortcode? How many load a Google font? But I decided I’d spent enough time avoiding real work this morning. If there’s other items you’re curious about, let me know I’ll see if I can find out and do a follow-up post.