Author config options
Author config options offer a flexible way to tailor author-related content on your website. These options can be accessed in the right-sidebar of the Edit Author screen under the Other Options section.
It's essential to be aware that these options are also present in the Theme Settings screen, within the Author Options section. The configurations in this section act as default values for all authors, which can be individually modified for each author using the Other Options section.
Similar to post and tag config options, author config options can be included or excluded in the authorConfig section of the config.json file.
How to add a custom author option?
Author config options are available in various types. Let's see an example of adding a select element to enable/disable the display of the author's bio on the author page:
"authorConfig": [
{
"name": "displayAuthorBio",
"label": "Display author bio",
"value": 1,
"type": "select",
"options": [
{
"label": "Enabled",
"value": 1
},
{
"label": "Disabled",
"value": 0
}
]
}
]
In the code snippet above, we:
- Specified the variable's name using the Name attribute.
- Used the Label attribute to provide the option's name as it appears in the sidebar.
- Set the default behavior with the Value attribute; using 1 means that the option will be enabled by default.
- Defined the Type attribute as select to create a select element with a drop-down list.
- In the Options section, defined each option available in the drop-down list and the variables it will change.
How to use author config options?
To utilize author config options in the author.hbs file, you can use the following markup:
{{#if authorViewConfig.displayAuthorBio}}
<div> {{{description}}} </div>
{{/if}}
When you change the option to "Disabled", the author's bio will not be displayed.
Note: all options can be used within conditions (i.e. if statements)
Available author config option types
Author config options include various option types that work similarly to post and tag config options. For a comprehensive understanding of each option type, refer to the post config options article, which provides an in-depth explanation of their usage and implementation.
The available option types are:
By leveraging these options types above, you can create a more engaging and customized experience for your author-related content..