We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

[ Theme Dev ] Adding Custom Properties

  • #1850
    Avatar photo[anonymous]


    I’ve trying to figure out if there is a way to add custom properties to a post type to select it from there.

    The use case is to create an events page. Ideally I’d add an events tag, and then be able to configure properties that would be shown both on the topic page as well as in the Individual post.

    Although for this I’s need to have a way to select the properties on the post, similarly to other post settings.

    I’ll keep looking at it, although for now it doesn’t really seem possible. Custom properties seem to only be possible for theme settings.

    Avatar photoBob

    Hi Alfatreze,

    I’m not sure I understood you correctly, but you can do it by  “postConfig” options →

    e.g. config.json

    "postConfig": [
                "name": "displayDate",
                "label": "Display date",
                "value": 1,
                "type": "select",
                "options": [
                        "label": "Enabled",
                        "value": 1
                        "label": "Disabled",
                        "value": 0

    and use it under the post.hbs file:

    {{ }}

    or/and under posts listing :

    {{ postViewConfig.displayDate }}
    Avatar photo[anonymous]

    Hi @bob, thank you for the tip. I hadn’t got to that part in detail, I’m a hand’s on kind of person and like jumping head first into things, and into documentation later.

    I does mostly work for what I wanted with a couple of caveats. One one that in publii 0.36, opening the post settings now overlays the content, it’s great to have a distraction free mode, but more useful if the writing section can work responsible side by side when you need the detail.

    Second is the lack of image type for the config as it would allow to add specific media for the post. I’ll probably re-use the featured media for what I need, and create new more global configs to set header images that should be more global anyway. Ideally being able to configure multiple would be awesome though.

    I also have a mind to try to hack a bit into the custom elements for a bit more malleability for creating posts, though behaviour is a little wonky in 0,36 especially when selecting multiple.

    I’ll look through the docs again and start hacking again, and share what I come up with 🙂