Skip to content

Commit

Permalink
Adds changelog.md. Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
justintadlock committed Aug 1, 2021
1 parent d583fe3 commit 6999dcc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 62 deletions.
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

You can see the changes made via the [commit log](https://github.com/themehybrid/hybrid-template/commits/master) for the latest release.

## [1.0.0] - 2021-08-01

### Added

- Launch. Everything's new!
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name" : "themehybrid/hybrid-template",
"description" : "Custom template registration system for WordPress.",
"description" : "Template helper functions.",
"keywords" : [ "wordpress" ],
"homepage" : "https://github.com/themehybrid/hybrid-template",
"license" : "GPL-2.0-or-later",
Expand Down
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

The code for the this project is handled via its [GitHub Repository](https://github.com/justintadlock/hybrid-theme). You can open tickets, create patches, and send pull requests there.
The code for the this project is handled via its [GitHub Repository](https://github.com/themehybrid/hybrid-template). You can open tickets, create patches, and send pull requests there.

## Pull requests

Expand Down
61 changes: 1 addition & 60 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,13 @@
# Hybrid\\Template

Hybrid Template is a package for registering custom post templates. Technically, it works for any object type (e.g., post, term, user, etc.), but does not add any UI elements of its own.

The major difference between this and the typical WordPress page template system is that the template doesn't have to exist for registration. It also defaults to supporting all post types instead of just `page`.
Hybrid Template is a set of helper functions for setting the location, locating, and filtering templates.

## Requirements

* WordPress 4.9+.
* PHP 5.6+ (preferably 7+).
* [Composer](https://getcomposer.org/) for managing PHP dependencies.

## Documentation

This project a part of the Hybrid Core framework. It may require other packages, which will be installed via Composer.

### Installation

First, you'll need to open your command line tool and change directories to your theme folder.

```bash
cd path/to/wp-content/themes/<your-theme-name>
```

Then, use Composer to install the package.

```bash
composer require themehybrid/hybrid-template
```

### Register the Service Provider

You need to register the service provider during your bootstrapping process. In your bootstrapping code, you should have something like the following:

```php
$themeslug = new \Hybrid\Core\Application();
```

After that point, you can register the service provider:

```php
$themeslug->provider( \Hybrid\Template\Provider::class );
```

## Register Templates

The following registers a custom post template named `template-canvas.html` (or `template-canvas.php` in classic WordPress themes).

```php
add_action( 'hybrid/templates/register', function( $templates ) {

$templates->add( 'template-canvas', [
'label' => __( 'Canvas' )
] );
} );
```

By default, the system will register the template for every post type. You can limit it to specific post types like so:

```php
add_action( 'hybrid/templates/register', function( $templates ) {

$templates->add( 'template-canvas', [
'label' => __( 'Canvas' ),
'post_types' => [ 'page', 'post' ]
] );
} );
```

## Copyright and License

This project is licensed under the [GNU GPL](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html), version 2 or later.
Expand Down

0 comments on commit 6999dcc

Please sign in to comment.