PHPackages                             piotrpress/wordpress-theme - 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. [Templating &amp; Views](/categories/templating)
4. /
5. piotrpress/wordpress-theme

ActiveLibrary[Templating &amp; Views](/categories/templating)

piotrpress/wordpress-theme
==========================

This library is WordPress theme singleton base class with methods to get data from theme's header fields.

v1.0.0(11mo ago)0541GPL-3.0PHPPHP &gt;=7.4

Since Jun 12Pushed 11mo agoCompare

[ Source](https://github.com/PiotrPress/wordpress-theme)[ Packagist](https://packagist.org/packages/piotrpress/wordpress-theme)[ Docs](https://github.com/PiotrPress/wordpress-theme)[ RSS](/packages/piotrpress-wordpress-theme/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

WordPress Theme
===============

[](#wordpress-theme)

This library is WordPress theme singleton base class with methods to get data from [theme's header fields](https://developer.wordpress.org/themes/core-concepts/main-stylesheet/#header-fields).

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

[](#installation)

```
composer require piotrpress/wordpress-theme
```

Usage
-----

[](#usage)

```
/**
 * Theme Name:        Example Theme
 * Theme URI:         https://example.com/theme/
 * Description:       Example Theme description.
 * Tags:              block-patterns, full-site-editing
 * Version:           1.0.0
 * Tested up to:      6.8
 * Requires at least: 6.0
 * Requires PHP:      7.4
 * Author:            John Smith
 * Author URI:        https://example.com/theme/author/
 * License:           GPL v3 or later
 * License URI:       https://www.gnu.org/licenses/gpl-3.0.txt
 * Update URI:        https://example.com/theme/update/
 * Text Domain:       example-theme
 * Domain Path:       /languages
 */

require __DIR__ . '/vendor/autoload.php';

class Example extends \PiotrPress\WordPress\Theme {}

echo Example::getName();
```

Methods
-------

[](#methods)

### Basic static methods handling theme's default header fields

[](#basic-static-methods-handling-themes-default-header-fields)

- `getName()` - returns `string` with the name of the theme from `Theme Name` header field
- `getThemeURI()` - returns `string` with the home page of the theme or empty `string` if `Theme URI` header field is not set
- `getDescription()` - returns `string` with a short description of the theme or empty `string` if `Description` header field is not set
- `getTags()` - returns `string` with the tags of the theme or empty `string` if `Tags` header field is not set
- `getVersion()` - returns `string` with the current version number of the theme or empty `string` if `Version` header field is not set
- `getRequiresWP()` - returns `string` with the lowest WordPress version that the theme will work on or empty `string` if `Requires at least` header field is not set
- `getRequiresPHP()` - returns `string` with the minimum required PHP version or empty `string` if `Requires PHP` header field is not set
- `getAuthor()` - returns `string` with the name of the theme's author or empty `string` if `Author` header field is not set
- `getAuthorURI()` - returns `string` with the website of the theme's author or empty `string` if `Author URI` header field is not set
- `getUpdateURI()` - returns `string` with third-party theme's update server or empty `string` if `Update URI` header field is not set
- `getTextDomain()` - returns `string` with the gettext text domain of the theme or empty `string` if `Text Domain` header field is not set
- `getDomainPath()` - returns `string` with the path to translations directory or empty `string` if `Domain Path` header field is not set

### Additional static methods

[](#additional-static-methods)

- `getDir()` - returns `string` with the path to theme's directory
- `getUrl()` - returns `string` with the url to theme's directory
- `getSlug()` - returns `string` with the sanitized name of the theme
- `getPrefix()` - returns `string` with the prefix for theme's hooks

### Inherited Singleton's static methods

[](#inherited-singletons-static-methods)

- `getInstance()` - returns the instance of the Theme class

### Handling custom theme's header fields

[](#handling-custom-themes-header-fields)

1. Add WordPress support for extra theme's header fields using `extra_theme_headers` filter:

```
add_filter( 'extra_theme_headers', function () {
    return [ 'License', 'License URI' ];
} );
```

2. Add methods to handle extra theme's header fields:

```
class Example extends \PiotrPress\WordPress\Theme {
    public static function getLicenseURI() {
        return self::get( 'License URI' );
    }
}
```

**NOTE:** `get` prefixed methods are automagically created for theme's header fields that meet valid function name rules. e.g. `getLicense()` method.

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

[](#requirements)

PHP &gt;= `7.4` version.

License
-------

[](#license)

[GPL 3.0](license.txt)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance51

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

340d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10326736?v=4)[Piotr Niewiadomski](/maintainers/PiotrPress)[@PiotrPress](https://github.com/PiotrPress)

---

Top Contributors

[![PiotrPress](https://avatars.githubusercontent.com/u/10326736?v=4)](https://github.com/PiotrPress "PiotrPress (1 commits)")

---

Tags

wordpresstemplateboilerplatewpthemebootstrapbasethemesstarter

### Embed Badge

![Health badge](/badges/piotrpress-wordpress-theme/health.svg)

```
[![Health](https://phpackages.com/badges/piotrpress-wordpress-theme/health.svg)](https://phpackages.com/packages/piotrpress-wordpress-theme)
```

PHPackages © 2026

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