Plugins / Post Formats

Post Formats

Allows users to assign different formats to their entries, which can then be rendered using different templates as supplied by a theme.

More Information

A theme must use the $theme->content($post) syntax for displaying post content to make use of this plugin.

When the $theme->content($post) is executed normally, a template is chosen for the value of $post that matches its content type, such as "entry.php" for Posts that are of type "entry". This plugin adds the format as part of the possible template name, so for example, if you select "Aside" as the format, the template that Habari first looks for to display the $post is "entry.aside.php". If "entry.aside.php" does not exist, then "entry.php" is used as a fallback.

A theme can advertise the format templates it supports by implementing the method filter_get_post_formats($formats). The method should add new format names to the $formats variable and return it. The formats will appear in the list on the post entry page and in the plugin configuration.

It is also possible to add custom formats to the list in the plugin configuration. These formats will do nothing unless the theme includes a matching template, but it does allow the possibility to add a template file to the theme for the format, then add the custom format to the list without altering the theme's class code, which might be handy.


Available Versions

Download Version Release Date Information
?.?.?-1.0 2023-03-25 More Information

Raw Directory Data (show)

Tagged