Open source plugins like Advanced Custom Fields and xxxx are great for quickly creating and editing new objects types within the WordPress’s Admin interface. But how can we easily display those custom object types, without writing custom php theme code?
Objx Model Tokens embed dynamic data into your page.
There are already several query blocks out there that allow you to fetch custom query posts and display them in cards, or a grid, or a list. Unfortunately, the options for visual display are usually quite limiting in such blocks. The is no real way to truly customize the visual layout and specify what information should be displayed, especially when dealing with your own custom post types. Objx Model Tokens select information from your post and allow you to insert that information where you want, styled how you want!
The Objx QueryLoop
The content inside an objx QueryLoop is referred to as its template, and provides the objxItem token to select information for display from the currently iterated post.
{{objxItem:my_custom_field_name}}
Inside a query loop, we can use the objxItem token to refer to the currently looped item
Post Tokens
Since all custom post types are subclasses of Post, the following tokens are always available, no matter what custom post type we are referencing.
Working with Metadata
We can select and display any registered meta data value with the meta keyword.
objxItem:meta:custom-meta-key-name
Form Tokens
The Objx Form block provides the objxForm token (only available from within a form block) with the following keys:
- objxForm:msg – Feed back message from the server, upon submission of the form
- objxForm:loading – Used to display a spinner while the form is submitting
- objxFormItem:custom-keys – Upon submission, the returned object is available using objxFormItem: