Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Update example service to follow up with the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jedrzejchalubek committed Jul 11, 2017
1 parent dc3a550 commit 17154e2
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/Setup/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,24 @@
use Tonik\Gin\Foundation\Theme;

/**
* Binding handler for book's genres service.
* Service handler for retrieving posts of specific post type.
*
* @return void
*/
function bind_books_genres_service()
function bind_books_service()
{
/**
* Binds service for retrieving genres of the specific book.
* Binds service for retrieving posts of specific post type.
*
* @param \Tonik\Gin\Foundation\Theme $theme Instance of the service container
* @param array $parameters Parameters passed on service resolving
*
* @return \WP_term[]
* @return \WP_Post[]
*/
theme()->bind('book/genres', function (Theme $theme, $parameters) {
return wp_get_post_terms($parameters['id'], 'book_grene');
theme()->bind('books', function (Theme $theme, $parameters) {
return new WP_Query([
'post_type' => 'book',
]);
});
}
add_action('init', 'App\Theme\Setup\bind_books_genres_service');
add_action('init', 'App\Theme\Setup\bind_books_service');

0 comments on commit 17154e2

Please sign in to comment.