PHPackages                             arraypress/wp-theme-utils - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. arraypress/wp-theme-utils

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

arraypress/wp-theme-utils
=========================

A lean WordPress library for working with themes and theme management

00PHP

Since Nov 12Pushed 7mo agoCompare

[ Source](https://github.com/arraypress/wp-theme-utils)[ Packagist](https://packagist.org/packages/arraypress/wp-theme-utils)[ RSS](/packages/arraypress-wp-theme-utils/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

WordPress Theme Utilities
=========================

[](#wordpress-theme-utilities)

A lightweight WordPress library for working with themes and theme management. Provides clean APIs for theme operations, feature detection, and value/label formatting perfect for forms and admin interfaces.

Features
--------

[](#features)

- 🎯 **Clean API**: WordPress-style snake\_case methods with consistent interfaces
- 🔍 **Built-in Search**: Theme search with value/label formatting
- 📋 **Form-Ready Options**: Perfect value/label arrays for selects and forms
- 🎨 **Feature Detection**: Easy theme feature and support checking
- 📄 **Template Management**: Page template discovery and formatting
- 🧩 **Child Theme Support**: Parent/child theme relationship handling
- 🏗️ **Block Theme Detection**: FSE and block theme identification
- 🔧 **Version Checks**: Theme version comparison utilities

Requirements
------------

[](#requirements)

- PHP 7.4 or later
- WordPress 5.0 or later

Installation
------------

[](#installation)

```
composer require arraypress/wp-theme-utils
```

Basic Usage
-----------

[](#basic-usage)

### Working with Single Themes

[](#working-with-single-themes)

```
use ArrayPress\ThemeUtils\Theme;

// Get current theme
$current_theme = Theme::get_current();

// Get theme by stylesheet
$theme = Theme::get( 'twentytwentyfour' );

// Check if theme exists
if ( Theme::exists( 'my-theme' ) ) {
	// Theme exists
}

// Get theme information
$name          = Theme::get_name();
$version       = Theme::get_version();
$directory_uri = Theme::get_directory_uri();

// Check if theme is active
if ( Theme::is_active( 'twentytwentyfour' ) ) {
	// Theme is active
}

// Check multiple themes
if ( Theme::is_active( [ 'theme-one', 'theme-two' ] ) ) {
	// One of the themes is active
}

// Check if using default WordPress theme
if ( Theme::is_default_active() ) {
	// Using a default WP theme
}

// Check theme features
if ( Theme::supports( 'post-thumbnails' ) ) {
	// Theme supports featured images
}

if ( Theme::supports_gutenberg() ) {
	// Theme supports Gutenberg features
}

if ( Theme::is_block_theme() ) {
	// Theme is a block/FSE theme
}

// Version checking
if ( Theme::is_version( '2.0', '>=' ) ) {
	// Current theme version is 2.0 or higher
}

// Child theme checking
if ( Theme::is_child() ) {
	$parent = Theme::get_parent();
}

// Theme mods
$logo = Theme::get_mod( 'custom_logo', false );
```

### Working with Multiple Themes

[](#working-with-multiple-themes)

```
use ArrayPress\ThemeUtils\Themes;

// Get all themes
$all_themes = Themes::get_all();

// Get themes as options for forms
$theme_options = Themes::get_options();
// Returns: [['value' => 'stylesheet', 'label' => 'Theme Name'], ...]

// Search themes
$search_results = Themes::search_options( 'twenty' );
// Returns: [['value' => 'twentytwentyfour', 'label' => 'Twenty Twenty-Four'], ...]

// Get page templates
$templates        = Themes::get_page_templates();
$template_options = Themes::get_page_template_options();

// Get filtered theme lists
$child_themes   = Themes::get_child_themes();
$parent_themes  = Themes::get_parent_themes();
$block_themes   = Themes::get_block_themes();
$default_themes = Themes::get_default_themes();

// Get themes by feature
$post_format_themes = Themes::get_by_feature( 'post-formats' );

// Get themes by author
$author_themes = Themes::get_by_author( 'WordPress.org' );

// Count themes
$theme_count = Themes::count();

// Check if multiple themes exist
if ( Themes::all_exist( [ 'theme-one', 'theme-two' ] ) ) {
	// All themes exist
}
```

### Page Templates

[](#page-templates)

```
// Get page templates from current theme
$templates = Themes::get_page_templates();
// Returns: ['' => 'Default Template', 'page-custom.php' => 'Custom Page']

// Get as form options
$template_options = Themes::get_page_template_options();
// Returns: [['value' => '', 'label' => 'Default Template'], ...]

// Without default template
$templates = Themes::get_page_templates( false );
$options   = Themes::get_page_template_options( false );
```

### Advanced Examples

[](#advanced-examples)

```
// Check if current theme supports specific features
$features_to_check  = [ 'post-thumbnails', 'custom-logo', 'html5' ];
$supported_features = Theme::get_supported_features( $features_to_check );

// Get theme hierarchy information
if ( Theme::is_child() ) {
	$parent_themes = Theme::get_parent_themes();
	foreach ( $parent_themes as $parent ) {
		echo "Parent: " . $parent->get( 'Name' ) . "\n";
	}
}

// Search for themes with specific capabilities
$modern_themes = Themes::search( 'gutenberg' );

// Get customizer URL for current theme
$customizer_url = Theme::get_customizer_url();

// Advanced feature checking examples
$required_features = [ 'post-thumbnails', 'custom-header', 'custom-background' ];
$optional_features = [ 'custom-logo', 'widgets', 'html5' ];

// Check if theme meets requirements
if ( Theme::supports_all_features( $required_features ) ) {
	$bonus_features = Theme::get_supported_features( $optional_features );
	echo "Theme ready! Bonus features: " . implode( ', ', $bonus_features );
} else {
	$missing_features = Theme::get_unsupported_features( $required_features );
	echo "Missing required features: " . implode( ', ', $missing_features );
}

// Check for modern theme capabilities
$modern_features = [ 'align-wide', 'responsive-embeds', 'editor-styles' ];
if ( Theme::supports_any_features( $modern_features ) ) {
	echo "Theme has modern Gutenberg support";
}
```

Key Features
------------

[](#key-features)

- **Value/Label Format**: Perfect for forms and selects
- **Feature Detection**: Easy theme capability checking
- **Block Theme Support**: FSE and block theme identification
- **Template Management**: Page template discovery and formatting
- **Child Theme Handling**: Parent/child relationships
- **Version Utilities**: Theme version comparison
- **Search Functionality**: Built-in theme search

Requirements
------------

[](#requirements-1)

- PHP 7.4+
- WordPress 5.0+

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This project is licensed under the GPL-2.0-or-later License.

Support
-------

[](#support)

- [Documentation](https://github.com/arraypress/wp-theme-utils)
- [Issue Tracker](https://github.com/arraypress/wp-theme-utils/issues)

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance44

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cd6eb8aff0903d87eb674d1ba3c5f3653899c0d7661504eb0deb7798ed86b643?d=identicon)[arraypress](/maintainers/arraypress)

---

Top Contributors

[![arraypress](https://avatars.githubusercontent.com/u/22668877?v=4)](https://github.com/arraypress "arraypress (2 commits)")

### Embed Badge

![Health badge](/badges/arraypress-wp-theme-utils/health.svg)

```
[![Health](https://phpackages.com/badges/arraypress-wp-theme-utils/health.svg)](https://phpackages.com/packages/arraypress-wp-theme-utils)
```

###  Alternatives

[mkdreams/mdword

OFFICE WORD 动态数据 绑定数据 生成报告；OFFICE WORD Dynamic data binding data generation report.

551.5k](/packages/mkdreams-mdword)[jeremytubbs/laravel-deepzoom

Laravel Deepzoom Tile Generator for OpenSeadragon

111.3k](/packages/jeremytubbs-laravel-deepzoom)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
