The Ghost Themes Developer Hub

Welcome to the Ghost Themes developer hub. You'll find comprehensive guides and documentation to help you start working with Ghost Themes as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

post_class

{{post_class}} Helper - Outputs dynamic CSS classes to identify a post

Usage: {{post_class}}

Type
Parameters
Attributes

n/a

n/a

Description

{{post_class}} – outputs classes intended for your post container, useful for targeting posts with styles.

The classes are as follows:

  • post - All posts automatically get a post class.
  • featured - All posts marked as featured get the featured class.
  • page - Any static page gets the page class.
  • tag-:slug - For each tag associated with the post, the post get a tag in the format tag-:slug.

For example:

A post which is not featured or a page, but has the tags photo and panoramic would get post tag-photo tag-panoramic as post classes.

A featured post with a tag of photo would get post tag-photo featured.

A featured page with a tag of photo and panoramic would get post tag-photo tag-panoramic featured page.

Setting a post as featured or as a page can be done from the post settings menu.

Example Code

<article class="{{post_class}}">
  {{content}}
</article>
<article class="post tag-photo featured">
    <p>Awesome post content</p>
</article>

post_class

{{post_class}} Helper - Outputs dynamic CSS classes to identify a post