Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
inc2734 committed Oct 16, 2016
1 parent b8cbb1d commit 0f5c8fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 166 deletions.
176 changes: 11 additions & 165 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,174 +9,20 @@ Minizuku is a WordPress theme to develop the child theme.
* GitHub: https://github.com/inc2734/mimizuku/
* Packagist: https://packagist.org/packages/inc2734/mimizuku

## Required
## Requirements
* PHP 5.6+
* WP-CLI
* Composer
* Node.js

## Get Started
### Install
Mimizuku is a parent theme. So you should download the Mimizuku child theme. See https://github.com/inc2734/mimizuku-child. If you build this child theme, aloso downloaded Mimizuku by composer.

```
$ cd /PATH/TO/wp-content/themes
$ git clone https://github.com/inc2734/mimizuku-child.git
$ cd mimizuku-child
$ composer install
```

### update
```
$ cd /PATH/TO/wp-content/themes/mimizuku-child
$ composer update mimizuku
```

## How to build
```
$ npm install
$ npm run gulp build
$ composer install
```

## Start up built-in server
```
$ bash app/bin/server.sh
```

## Import theme unit test data
```
$ bash app/bin/theme-unit-test.sh
```

## Generate files needed for running PHPUnit tests.
```
$ bash app/bin/scaffold-tests.sh
```

## Run PHPUnit tests
### Generate WordPress tests environment and run phpunit
```
$ bash app/bin/wpphpunit.sh
```

### Run phpunit only
```
$ phpunit
```

## Directory structure

### Directory for layout templates
```
/layout/wrapper
```

### Directory for header templates
```
/layout/header
```

### Directory for footer templates
```
/layout/footer
```

### Directory for view templates
```
/views
```

### Directory for static view templates
```
/views/static
```

Mimizuku tries to load the view template according to the URL. For example when URL is http://example.com/foo/bar, tries to laod from `/views/static/foo/bar.php`.

## Using view controller
```
$controller = new \Mimizuku\App\Controllers\Controller();
$controller->layout( 'right-sidebar' );
$controller->render( 'content/content', 'news' );
```

## Template tags

### \\Mimizuku\\App\\Tags\\get_template_part()

This is a function which to pass the variables to WordPress's `get_template_part()`.

```
// The caller
\Mimizuku\App\Tags\get_template_part( 'path/to/template-parts', [
'_foo' => 'bar',
'_baz' => 'qux',
] );
// The called template. path/to/template-parts.php
<ul>
<li><?php echo esc_html( $_foo ); // bar ?></li>
<li><?php echo esc_html( $_baz ); // qux ?></li>
</ul>
```

## Filter hooks

### mimizuku_layout

Filtering layout file.

```
add_filter( 'mimizuku_layout', function( $layout ) {
return $layout;
} );
```

### mimizuku_view

Filtering view file.

```
add_filter( 'mimizuku_view', function( $view ) {
return $view;
} );
```

### mimizuku_header

Filtering header layout file.

```
add_filter( 'mimizuku_header', function( $header ) {
return $header;
} );
```

### mimizuku_footer

Filtering footer layout file.

```
add_filter( 'mimizuku_footer', function( $footer ) {
return $footer;
} );
```

### mimizuku_content_width

Filtering `$content_width` of WordPress.

```
add_filter( 'mimizuku_content_width', function( $content_width ) {
return $content_width;
} );
```

### mimizuku_support_ie9

Filtering loading `basis-ie9.css`.

```
add_filter( 'mimizuku_support_ie9', function( $boolean ) {
return $boolean;
} );
```
## Theme features
* Having layout and view templates
* and having filter hooks filtered these templates
* Using view controller
* The fuunction which to pass the variables to WordPress's `get_template_part()`.
* Usuful shell scripts
* CI
* See more https://github.com/inc2734/mimizuku-child
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$controller = new \Mimizuku\App\Controllers\Controller();
$controller->layout( 'right-sidebar' );
if ( have_posts() ) {
$controller->render( 'archive/archive' );
$controller->render( 'archive/archive', get_post_type() );
} else {
$controller->render( 'content/content', 'none' );
}

0 comments on commit 0f5c8fc

Please sign in to comment.