PHPackages                             lin3s/template-selector - 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. lin3s/template-selector

ActiveWordpress-plugin[Templating &amp; Views](/categories/templating)

lin3s/template-selector
=======================

Adds a field to declare templates used by pages dynamically

v1.1.0(10y ago)03.0kMITPHP

Since Jul 30Pushed 10y agoCompare

[ Source](https://github.com/LIN3S/WPTemplateSelector)[ Packagist](https://packagist.org/packages/lin3s/template-selector)[ RSS](/packages/lin3s-template-selector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

Template selector
=================

[](#template-selector)

> Adds a field to declare templates used by pages dynamically

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9e2d22e9dc60f249a7bfe4e8bebfddacae144209a3427ce8127ed84d2f17d0b6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4c494e33532f575054656d706c61746553656c6563746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/LIN3S/WPTemplateSelector/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/d98e1b8132d4d76bdf7ba0349ead5eaf9858b72da4e1634356553c327851449f/68747470733a2f2f706f7365722e707567782e6f72672f6c696e33732f74656d706c6174652d73656c6563746f722f646f776e6c6f616473)](https://packagist.org/packages/lin3s/template-selector) [![Latest Stable Version](https://camo.githubusercontent.com/d0a9a159ca84678ca9f7fb144f49eb7cf26697f5267706ffd7b80cfb0ac94bc4/68747470733a2f2f706f7365722e707567782e6f72672f6c696e33732f74656d706c6174652d73656c6563746f722f762f737461626c652e737667)](https://packagist.org/packages/lin3s/template-selector)[![Latest Unstable Version](https://camo.githubusercontent.com/5b5f0bce736bf967a24ca1953fa4254c63cb20483630e7f7f30a45bddc01c84f/68747470733a2f2f706f7365722e707567782e6f72672f6c696e33732f74656d706c6174652d73656c6563746f722f762f756e737461626c652e737667)](https://packagist.org/packages/lin3s/template-selector)

DEPRECATED: included in [WPFoundation 1.6.0](https://github.com/LIN3S/WPFoundation)
===================================================================================

[](#deprecated-included-in-wpfoundation-160)

This feature is included by default in WPFoundation since version 1.6.0. You just need to extend the abstract class `LIN3S\WPFoundation\Configuration\Theme\Theme` to get it working.

Why?
----

[](#why)

[LIN3S](http://lin3s.com)'s [WPRouting](https://github.com/LIN3S/WPRouting) is a very robust solution to manage the Wordpress routing system in a [Symfony](https://symfony.com/) way. We came up with this solution in our way to a MVC architecture because many PHP files where scattered in our template root directory with dummy unstructured code.

This way, we are now able to match routes used by Wordpress with the actions from our Controllers, letting us to keep a simpler a more intuitive theme folder structure for new coming developers.

We faced some issues when we started using WP-Routing plugin, creating a php file in theme's root folder had no sense just to add an annotation. Therefore, we came up with this alternative to avoid using annotations to declare new page templates.

With this plugin you can now use a hook to add your custom page templates, and the default template selector items will be replaced with your programatically declared templates.

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

[](#installation)

The recommended and the most suitable way to install is through Composer. Be sure that the tool is installed in your system and execute the following command:

```
$ composer require lin3s/template-selector

```

*Remember that Template Selector is a* **Wordpress plugin** *so, they can customize the location path easily with Composer ([more info](https://getcomposer.org/doc/faqs/how-do-i-install-a-package-to-a-custom-path-for-my-framework.md)):*

```
"extra": {
    "installer-paths": {
        "src/plugins/{$name}/": ["type:wordpress-plugin"],
        "src/themes/{$name}/": ["type:wordpress-theme"],
        "src/mu-plugins/{$name}/": ["type:wordpress-muplugin"]
    }
}
```

Usage
-----

[](#usage)

To declare the templates just add the following hook to your WordPress theme.

```
add_filter('template_selector_available', [$this, 'templates']);

public function templates($templates) {
    return array_merge($templates, [
        'template-slug'    => 'Template name shown in admin',
        'another-template' => 'Another template'
    ]);
}
```

Licensing Options
-----------------

[](#licensing-options)

[![License](https://camo.githubusercontent.com/84d497c3381fe8a504cf8e2e8e781db7c76b7cd6c189945470362dc25b53fd07/68747470733a2f2f706f7365722e707567782e6f72672f6c696e33732f74656d706c6174652d73656c6563746f722f6c6963656e73652e737667)](https://github.com/LIN3S/WPTemplateSelector/blob/master/LICENSE)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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

Every ~143 days

Total

3

Last Release

3659d ago

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/06308bfc15d8774c16d36d727f852c2d29ed8d0d6153637384439747776dc658?d=identicon)[benatespina](/maintainers/benatespina)

---

Top Contributors

[![benatespina](https://avatars.githubusercontent.com/u/3951376?v=4)](https://github.com/benatespina "benatespina (5 commits)")[![gorkalaucirica](https://avatars.githubusercontent.com/u/1749891?v=4)](https://github.com/gorkalaucirica "gorkalaucirica (5 commits)")

---

Tags

lin3sWP Plugintemplate selector

### Embed Badge

![Health badge](/badges/lin3s-template-selector/health.svg)

```
[![Health](https://phpackages.com/badges/lin3s-template-selector/health.svg)](https://phpackages.com/packages/lin3s-template-selector)
```

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

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