Skip to content

Commit

Permalink
Merge branch 'rc-v1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
jjgrainger committed Apr 28, 2017
2 parents 58243a8 + 80d3505 commit c401856
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 62 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: php
php:
- 5.6
- 7.0
- 7.1
- hhvm
script:
- ./vendor/bin/phpcs --standard=PSR2 src
before_script:
- composer self-update
- composer install --dev --no-interaction --prefer-source
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

##### v1.1
* fixed [issue #6](https://github.com/jjgrainger/PostTypes/issues/6): problem registering existing taxonomies
* add [issue #1](https://github.com/jjgrainger/PostTypes/issues/1): Add PHPCS and Travic integration
* Merged [pull request #3](https://github.com/jjgrainger/PostTypes/pull/3): Add `labels()` method to `PostTypes`
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# PostTypes v1.0
# PostTypes v1.1

Simple WordPress custom post types.
[![Build Status](https://travis-ci.org/jjgrainger/PostTypes.svg?branch=master)](https://travis-ci.org/jjgrainger/PostTypes)

> Simple WordPress custom post types.
## Installation

Expand Down Expand Up @@ -72,6 +74,20 @@ $books = new PostType('book', $options);

All available options are on the [WordPress Codex](https://codex.wordpress.org/Function_Reference/register_post_type)

#### Adding labels

You can define the labels for the post type by passing an array as the third argument in the class constructor.

```php
$labels = [
'featured_image' => __( 'Book Cover Image' ),
];

$books = new PostType('book', $options, $labels);
```

All available labels are on the [WordPress Codex](https://codex.wordpress.org/Function_Reference/register_post_type)

#### Exisiting Post Types

To work with exisiting post types simple pass the post type name into the object. Be careful using global variables (i.e `$post`) which can lead to unwanted results.
Expand Down Expand Up @@ -118,7 +134,7 @@ You can further customise taxonomies by passing an array of options as the secon

```php
$options = [
'heirarchical' => false
'hierarchical' => false,
];

$books->taxonomy('genre', $options);
Expand Down Expand Up @@ -186,7 +202,7 @@ $books->columns()->set([

###### Column Order

After hiding and adding columns you may want to rearrange the column order. To do this use the `order()` method. You only have to pass through an array of the columns you want to reposition, not all of them. Their positions are based on a zero based index.
After hiding and adding columns you may want to rearrange the column order. To do this use the `order()` method. You only have to pass through an array of the columns you want to reposition, not all of them. Their positions are based on a zero based index.

```php
$books->columns()->order([
Expand Down Expand Up @@ -231,7 +247,7 @@ $books->columns()->sortable([

#### Menu Icons

With WordPress 3.8 comes [Dashicons](https://developer.wordpress.org/resource/dashicons/) an icon font you can use with your custom post types.
With WordPress 3.8 comes [Dashicons](https://developer.wordpress.org/resource/dashicons/) an icon font you can use with your custom post types.

```php
$books->icon('dashicons-book-alt');
Expand Down Expand Up @@ -267,4 +283,3 @@ $books->translation('your-textdomain');

* [http://jjgrainger.co.uk](http://jjgrainger.co.uk)
* [http://twitter.com/jjgrainger](http://twitter.com/jjgrainger)

3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0"
"php": ">=5.3.0",
"squizlabs/php_codesniffer": "^2.8"
},
"autoload": {
"psr-4": { "PostTypes\\": "src/" }
Expand Down
5 changes: 2 additions & 3 deletions src/Columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
*
* Used to help manage a post types columns in the admin table
*
* @link http://github.com/jjgrainger/wp-custom-post-type-class/
* @link http://github.com/jjgrainger/PostTypes/
* @author jjgrainger
* @link http://jjgrainger.co.uk
* @version 1.4
* @version 1.1
* @license http://www.opensource.org/licenses/mit-license.html MIT License
*/
class Columns
Expand Down Expand Up @@ -136,4 +136,3 @@ public function sortable($sortable)
}
}
}

Loading

0 comments on commit c401856

Please sign in to comment.