Template API

By Omid Borjian

Template API

Templates have a set of utility functions and filters to make it easy to create dynamic content. CMOkit is a headless CMS, you can use the template API or the REST API to get data in and out of your website.

Header : This function will insert header.html content in a template.
{{ header() }} 

Footer : This function will insert header.html content in a template.
{{ footer() }} 

Head : This will include important headers into your header
{{ get_head() }}

Head : This will include important headers into your header
{{ get_head() }}

Posts: Get the posts for your site
{{ get_posts(options)}} 

options:
-limit : Integer : limit the posts to retrieve
-category : Integer : category of the posts
-content_type : String : type of the post (default 'posts')

Categories: Get the categories for your site
{{ get_categories(options)}} 

options:
-limit : Integer : limit the posts to retrieve
-parent : Integer : parent id of the category (default is 0)

Category: Get the category given the id OR name
{{ get_category(options)}} 

options:
-id : Integer : limit the posts to retrieve
-slug : String : name/slug of the category

Don't forget to share this post!


By Omid Borjian

Scroll Up