Functions - miya0001/content-template-engine GitHub Wiki

Conditional Functions

There are some conditional functions assigned from WordPress.

  • is_home()
  • is_front_page()
  • is_single()
  • is_sticky()
  • is_page()
  • is_category()
  • is_tag()
  • is_tax()
  • is_author()
  • is_date()
  • is_year()
  • is_month()
  • is_day()
  • is_time()
  • is_new_day()
  • is_archive()
  • is_search()
  • is_404()
  • is_paged()
  • is_attachment()
  • is_singular()
  • is_feed()
  • is_user_logged_in()
  • in_category()

For example:

{% if is_home() %}
  <h2>Hello {{ post.acf.your_name }}!</h2>
{% endif %}

Other custom functions

include_post()

You can include specific post into the post/page.

Following example includes post that has id 1234.

{% include_post( '1234' ) %}

Default functions

See also Twig official documentation.

⚠️ **GitHub.com Fallback** ⚠️