Post templates allow you to customize the look of single post pages and the look of posts and media in listings and slideshows.
With the help of post templates, you can display data in various ways.
For example, you can have the date above the title, the title below the thumbnail and so on.
You have also the possibility to display custom content.
For instance, you can put a custom image, button, link or - with the help of the [widget_area] shortcode - widgets above the post title or below the post thumbnail or anywhere you want.
In addition, the [do_action] shortcode gives you the possibility to display PHP generated content.
For example, you can display content based on the value of a custom field or the user of the post or anything else.
And to make post templates more flexible, similar to other theme options, you can use selectors for post template settings.
For instance, with the help of selectors you can select different post templates for posts according to their post format, post type, author, and so on.
For further details, please see the Selectors section.
You will find a Post Template option under Posts » Post Settings » Single Post Settings / News » News Settings » Single News Settings / Portfolio » Portfolio Settings » Single Portfolio Settings. Here you can select the post template you want to use for single posts and this setting can be overridden for each single post with the Post Template option on Edit post page.
The "Post Template" options on Blog, News and Portfolio pages and under Theme Options » Author/Search/404 allow you to select a post template for posts in listings.
Additionally, if a listing is displayed with a shortcode (Post List shortcodes, [gallery_list] shortcode), you can use the post_template attribute of a nested [item_settings] shortcode to select a post template for the posts and media appearing in the list.
Similar to listings, the Post Template option of a slideshow allows you to select a post template for the slides.
You can create and manage post templates under Templates » Post Templates. The theme comes with a few predefined post templates to choose from and you can create custom ones. The contents of custom post templates can be edited the same way as the contents of posts and pages, and you can also use shortcodes in them. The predefined post templates give you a good basis to create your own post templates.
If you take a look at a predefined post template, you will see that a post template is nothing else than some shortcodes and a few HTML tags for formatting. The theme provides several post template specific shortcodes that allow you to display post data (such as title, author, categories, thumbnail and some more). These shortcodes are detailed in the next section.
Additionally, post templates are categorized. The category indicates what the post template is intended to be used for.
If you want to create a custom post template, in most cases, it is advisable to choose a predefined post template from the appropriate category as a basis.
To create your own post template:
Optionally, you can change the categories of your post template. The Categories option specifies where you want to use the post template:
There is no significant difference between post templates for slideshows and listings, but there is an important thing you should keep in mind when you are creating a custom post template for slideshows.
How will it look when there is no enough space vertically?
For instance, if the post template displays the post thumbnail and the height of the slideshow is less than the height of the image, then the image should be scaled down while keeping the aspect ratio.
The problem is more complex if the slideshow is displayed in a popup window. In these cases, you have no control over the height of the slideshow. It is determined by the screen size of the user.
A part of the problems can be solved with CSS, but there are cases when the CSS language does not provide enough flexibility. This is the reason why we have created the CSSEx JavaScript toolkit that extends the CSS language.
If you take a look a couple of predefined post templates for slideshows (such as the "Slider - Post thumbnail" template), you will see something like this:
[post_media class="js-flex-height-media-on" /]
As you can see, the "js-flex-height-media-on" CSS class is set for the post_media shortcode. This is one of the features provided by the CSSEx JavaScript toolkit.
The post_media shortcode adds a couple of wrapper elements around the media and the "js-flex-height-media-on" class will be set on the outermost HTML element created by the post_media shortcode.
<div class="media_wrapper js-flex-height-media-on">
<div class="media_inner_wrapper">
<img src="..." />
</div>
</div>
The "js-flex-height-media-on" CSS class marks every media element which is descendant of the current element as a flexible height element.
It means that if there is no enough space for the image vertically, its height will be reduced.
It works similarly to CSS max-height:100% but gives you much more possibilities.
For further details, please see the CSS Extension JavaScript Toolkit.
These shortcodes can only be used in post templates and display post titles, authors, media and thumbnails, categories, comments and some more.
Displays an HTML article tag to enclose the post.
Attributes: | |
---|---|
add_post_classes |
Specifies whether to add post specific CSS classes to the article element or not (true | false). Default is true.
Post specific classes are:
Please note that if the post is displayed in a list/slideshow and there is no post article shortcode in the the post template used for displaying the post or the add_post_classes attribute of post_article is set to false, the post specific classes will be added to the HTML wrapper element of the list item/slide that contains the post. |
Displays an HTML header tag to enclose the post title and meta. The header tag should be inside an article tag in HTML5.
Displays an HTML footer tag to enclose some post related information. Typically used for displaying the number of comments or a read more link at the bottom of the post.
Displays an HTML element to enclose post meta information (typically the date, author, categories and tags).
Displays an HTML element to enclose post body (typically the post thumbnail and content).
Displays the post title.
Attributes: | |
---|---|
heading_tag |
Specifies the HTML heading element of the post title ('h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6').
Default is 'h1' on single post pages and 'h2' in post lists.
Base options:
|
heading_class |
Specifies a CSS class for the heading of the post title. Default is an empty string.
The theme supports different classes for headings (see Headings) that allow you to display headings in different sizes, but you can also use custom CSS classes.
Base options:
|
show_as_link |
Specifies whether the title should appear as a link or a plain text ( true | false ).
Base options:
|
title_field |
Allows you to specify a custom field that contains the title to display. If the given custom field does not exist or empty for a post, the post title will be displayed.
This attribute is typically useful if you want to break some post titles to multiple lines in a post list. If you want to break a title, create a new custom field on the post page, copy the post title into the custom field and add a <br/> where you want to break it. |
Displays the post date.
Attributes: | |
---|---|
icon |
Specifies a date icon. Basically, the 'time', 'time-2', 'time-3', 'time-4', 'time-5', 'hour-glass', 'calendar', 'calendar-2' and 'calendar-3' icons are for dates, but you can use any icon.
For a complete list of icons, see Font Icons.
If you want to hide the icon, use the value of 'none'.
Base options:
|
iconset |
Specifies the icon set that contains the date icon (see icon above).
If no icon set is specified, the theme automatically tries to find an icon set that contains the icon. For the supported icon sets, see Font Icons.
Base options:
|
date_format |
Specifies the date format used to display the date. The default is the Date Format of your site specified under Settings > General.
An empty string means the Time format of your site specified under Settings > General.
For further details on the available date formats, please see Documentation on date and time formatting.
You can prevent a recognized character in the date format string from being expanded by escaping it with preceding double backslashes.
For example:
displays 'Published August 28, 2012'.
|
timestamp | Specifies whether the created or the modified time of the post should be displayed (created | modified). Default is 'created'. |
elapsed_newer | If this attribute is specified, then the elapsed time will be displayed for posts younger than the given number of seconds. For example, if this value is 60, then the timestamp will be displayed for posts beyond one minute while the elapsed time will be displayed for others (younger than 1 minute). If the value is 0, it means that no elapsed time is needed at all, while negative values mean than the elapsed time should be displayed for all posts. Default is 0. |
ago_format | Specifies the text format used to display the elapsed time (see elapsed_newer attribute above). The %s token is replaced by the elapsed time. Default is '%s ago'. |
translate |
Specifies the domain to be used to translate the text given by the 'date_format' and 'ago_format' attributes.
The default is 'dottoro_theme' which is the text domain of the Dottoro theme.
An empty string means that no translation is required.
This attribute is mostly useful if your own translations are loaded into a domain different than the text domain of the Dottoro theme, or if you want to prevent the translation of the text specified by the 'date_format' and 'ago_format' attributes. For further details, please read I18n for WordPress Developers. |
Displays the post author.
Attributes: | |
---|---|
icon |
Specifies an icon to display for the post author. Basically, the 'user', 'user-2', 'users', 'users-2', 'v-card', 'v-card-2', 'v-card-3' and 'v-card-4' icons for authors, but you can use any icon.
For a complete list of icons, see Font Icons.
If you want to hide the icon, use the value of 'none'.
Base options:
|
iconset |
Specifies the icon set that contains the author icon (see icon above).
If no icon set is specified, the theme automatically tries to find an icon set that contains the icon. For the supported icon sets, see Font Icons.
Base options:
|
text | Specifies the author text format. The %s token is replaced by the post author. An empty string means that only the author will be displayed without any additional text. Default is 'by %s'. |
translate |
Specifies the domain to be used to translate the author text (see 'text' attribute above).
The default is 'dottoro_theme' which is the text domain of the Dottoro theme.
An empty string means that no translation is required.
This attribute is mostly useful if your own translations are loaded into a domain different than the text domain of the Dottoro theme, or if you want to prevent the translation of the author text. For further details, please read I18n for WordPress Developers. |
Displays the categories of the post.
Attributes: | |
---|---|
icon |
Specifies a category icon. Basically, the 'folder', 'nav', 'nav-2', 'nav-3', 'nav-4' and 'flag' icons are for categories, but you can use any icon.
For a complete list of icons, see Font Icons.
If you want to hide the icon, use the value of 'none'.
Base options:
|
iconset |
Specifies the icon set that contains the category icon (see icon above).
If no icon set is specified, the theme automatically tries to find an icon set that contains the icon. For the supported icon sets, see Font Icons.
Base options:
|
separator | Specifies the separator string between categories. Default is ', '. |
text | Specifies the category text format. The %s token is replaced by the post categories. An empty string means that only the categories will be displayed without any additional text. Default is 'in %s'. |
translate |
Specifies the domain to be used to translate the category text (see 'text' attribute above).
The default is 'dottoro_theme' which is the text domain of the Dottoro theme.
An empty string means that no translation is required.
This attribute is mostly useful if your own translations are loaded into a domain different than the text domain of the Dottoro theme, or if you want to prevent the translation of the category text. For further details, please read I18n for WordPress Developers. |
Displays the tags of the post.
Attributes: | |
---|---|
icon |
Specifies a tag icon. Basically, the 'tag', 'tag-2', 'tag-3', 'tag-4', 'tag-5', 'paperclip', 'marker', 'marker-2', 'marker-3' icons are for tags, but you can use any icon.
For a complete list of icons, see Font Icons.
If you want to hide the icon, use the value of 'none'.
Base options:
|
iconset |
Specifies the icon set that contains the tag icon (see icon above).
If no icon set is specified, the theme automatically tries to find an icon set that contains the icon. For the supported icon sets, see Font Icons.
Base options:
|
separator | Specifies the separator string between tags. Default is ', '. |
text | Specifies the tag text format. The %s token is replaced by the post tags. An empty string means that only the tags will be displayed without any additional text. Default is 'Tags: %s'. |
translate |
Specifies the domain to be used to translate the tag text (see 'text' attribute above).
The default is 'dottoro_theme' which is the text domain of the Dottoro theme.
An empty string means that no translation is required.
This attribute is mostly useful if your own translations are loaded into a domain different than the text domain of the Dottoro theme, or if you want to prevent the translation of the tag text. For further details, please read I18n for WordPress Developers. |
Displays a link to edit the post, if a user is logged in and allowed to edit the post.
Attributes: | |
---|---|
link | The link text. Default is 'Edit This'. |
before | Text to put before the link text. Default is ' | '. |
after | Text to put after the link text. Default is an empty string. |
Displays a media.
Attributes | |
---|---|
align |
Specifies the alignment of media (center | left | left_float | right | right_float). This setting only has an effect if the post template supports it.
Base options:
|
width |
Specifies the width of the media, in pixels.
For external media, it specifies the max-width.
Base options:
|
height |
Specifies the height of the media, in pixels.
For external media, it specifies the max-height.
Base options:
|
sizing_method |
Specifies the sizing method for media (exact | max-cut | max-nocut).
Base options:
|
show_caption |
Specifies whether the media caption should be displayed or not ( true | false ).
Base options:
|
show_frame |
Specifies whether to add a frame around the media, or not (true | false).
Base options:
|
overlay |
Specifies the identifier of the overlay that should appear over the media.
To get the identifier of an overlay, go to Templates » Overlays and click on the overlay. Here you will find the id of the overlay.
Base options:
More on Overlays.
|
thumbnail_in_navigation | Specifies whether the [post_media] shortcode should work as the [post_thumbnail] shortcode in slideshow navigations or not (true | false). Default is true. |
Displays the thumbnail of the post.
Attributes: | |
---|---|
align |
Specifies the alignment of thumbnail images (center | left | left_float | right | right_float). This setting only has an effect if the post template supports it.
Base options:
|
width |
Specifies the width of the thumbnail, in pixels.
Base options:
|
height |
Specifies the height of the thumbnail, in pixels.
Base options:
|
show_caption |
Specifies whether the image caption should be displayed or not ( true | false ).
Base options:
|
show_frame |
Specifies whether to add a frame around the thumbnail, or not (true | false).
Base options:
|
overlay |
The identifier of the overlay that should appear over the thumbnail.
To get the identifier of an overlay, go to Templates » Overlays and click on the overlay. Here you will find the id of the overlay.
Base options:
More on Overlays.
|
Displays the content of the post. For media and slides, it displays the description.
Attributes: | |
---|---|
post_preview |
Specifies whether the whole content, the teaser, the excerpt or none of them should be shown.
Possible values: full, excerpt, teaser_excerpt, teaser, only_title. This attribute does not have an effect on media and slides, only posts.
Base options:
|
excerpt_length |
Specifies the length of excerpts in characters.
Works for both media descriptions and excerpts of posts.
Base options:
|
Displays the tooltip text of the post.
For media, the tooltip text can be set with the Tooltip option.
For posts and pages, the tooltip displays the post title but you can change this behavior with the fallback attribute.
Attributes: | |
---|---|
fallback |
Specifies what data should be displayed if the there is no tooltip for the post or media.
Possible values:
|
Displays a text hovering over the post content appears as a tooltip. Works only on portfolio pages and when the Show preview as tooltip option is enabled.
Attributes: | |
---|---|
text | Specifies the text to display. Default is 'info'. |
translate |
Specifies the domain to be used to translate the text given by the 'text' attribute.
The default is 'dottoro_theme' which is the text domain of the Dottoro theme.
An empty string means that no translation is required.
This attribute is mostly useful if your own translations are loaded into a domain different than the text domain of the Dottoro theme, or if you want to prevent the translation of the text specified by the 'text' attribute. For further details, please read I18n for WordPress Developers. |
Displays a read more link pointing to the post's page.
Attributes: | |
---|---|
icon_after |
Specifies a read more icon. Basically, the 'arrow-right', 'arrow-right-2', 'arrow-right-3', 'arrow-right-4', 'arrow-right-5', 'arrow-right-6', 'arrow-right-7' and 'arrow-right-8' icons are for read more, but you can use any icon.
For a complete list of icons, see Font Icons.
If you want to hide the icon, use the value of 'none'.
This attribute has an effect only if the read more text appears as a link (see type attribute).
Base options:
|
iconset_after |
Specifies the icon set that contains the read more icon (see icon_after above).
If no icon set is specified, the theme automatically tries to find an icon set that contains the icon. For the supported icon sets, see Font Icons.
Base options:
|
skin |
Set the skin of the read more button (available skins).
Base options:
|
text | Specifies the read more text. |
translate |
Specifies the domain to be used to translate the read more text.
The default is 'dottoro_theme' which is the text domain of the Dottoro theme.
An empty string means that no translation is required.
This attribute is mostly useful if your own translations are loaded into a domain different than the text domain of the Dottoro theme, or if you want to prevent the translation of the read more text. For further details, please read I18n for WordPress Developers. |
type |
Set whether to display the 'read more' text as a button or link ( button | link ).
Base options:
|
Displays a visit site link that opens the page specified by:
Attributes: | |
---|---|
icon_after |
Specifies a visit site icon. Basically, the 'arrow-right', 'arrow-right-2', 'arrow-right-3', 'arrow-right-4', 'arrow-right-5', 'arrow-right-6', 'arrow-right-7' and 'arrow-right-8' icons are for visit site, but you can use any icon.
For a complete list of icons, see Font Icons.
If you want to hide the icon, use the value of 'none'.
This attribute has an effect only if the visit site text appears as a link (see type attribute).
Base options:
|
iconset_after |
Specifies the icon set that contains the visit site icon (see icon_after above).
If no icon set is specified, the theme automatically tries to find an icon set that contains the icon. For the supported icon sets, see Font Icons.
Base options:
|
skin |
Set the skin of the visit site button (available skins).
Base options:
|
text | Specifies the visit site text. |
translate |
Specifies the domain to be used to translate the visit site text.
The default is 'dottoro_theme' which is the text domain of the Dottoro theme.
An empty string means that no translation is required.
This attribute is mostly useful if your own translations are loaded into a domain different than the text domain of the Dottoro theme, or if you want to prevent the translation of the visit site text. For further details, please read I18n for WordPress Developers. |
type |
Set whether to display the 'visit site' text as a button or link ( button | link ).
Base options:
|
Displays the comments list and the comment form.
Displays the number of comments for the post.
Attributes: | |
---|---|
icon |
Specifies a comments icon. Basically, the 'comment', 'comment-wire', 'comment-2', 'comment-wire-2', 'comment-3', 'comment-4', 'comment-5', 'comment-6', 'comment-7', 'comment-8', 'comments', 'comments-wire', 'comments-2' and 'comments-wire-2' icons are for comments, but you can use any icon.
For a complete list of icons, see Font Icons.
If you want to hide the icon, use the value of 'none'.
Base options:
|
iconset |
Specifies the icon set that contains the comments icon (see icon above).
If no icon set is specified, the theme automatically tries to find an icon set that contains the icon. For the supported icon sets, see Font Icons.
Base options:
|
text |
Specifies the comment text format. The %s token is replaced by the number of comments. An empty string means that the number of comments will be displayed.
This attribute is mostly useful if you want to use the same text format regardless of the number of comments. |
text_comment_0 |
Specifies the text format to be used when the post has no comments. The %s token is replaced by the number of comments (0). Default is 'No Comments.
Overrides the value of the 'text' attribute. |
text_comment_1 |
Specifies the text format to be used when the post has one comment. The %s token is replaced by the number of comments (1). Default is '1 Comment'.
Overrides the value of the 'text' attribute. |
text_comments |
Specifies the text format to be used when the post has more than one comment. The %s token is replaced by the number of comments. Default is '%s Comments'.
Overrides the value of the 'text' attribute. |
translate |
Specifies the domain to be used to translate the comment text (see text attributes above).
The default is 'dottoro_theme' which is the text domain of the Dottoro theme.
An empty string means that no translation is required.
This attribute is mostly useful if your own translations are loaded into a domain different than the text domain of the Dottoro theme, or if you want to prevent the translation of the comment text. For further details, please read I18n for WordPress Developers. |
Displays the post pagination. Works only on the pages of multi-page posts.
Displays the post type. Typically useful for lists displaying posts from different post types (search, author, 404).
Attributes: | |
---|---|
before | Text to put before the post type text. Default is ' | '. |
after | Text to put after the post type text. Default is an empty string. |
Displays a link to the previous post (in chronological order). Can only be used on single post pages.
Attributes: this shortcode has the same attributes as the WordPress previous_post_link method (format, link, in_same_cat, excluded_categories).
Displays a link to the next post (in chronological order). Can only be used on single pages.
Attributes: this shortcode has the same attributes as the WordPress next_post_link method (format, link, in_same_cat, excluded_categories).
[post_article class="post-template-single"]
[post_header]
[post_title /]
[post_meta]
[post_date /]
[post_category /]
[post_author /]
[post_edit_link /]
[/post_meta]
[/post_header]
[post_body]
[post_thumbnail /]
[post_content /]
[clear /]
[/post_body]
[post_pagination style="margin-top:20px"/]
[post_footer]
[post_tags /]
[/post_footer]
[/post_article]
[do_action action="dottoro_single_bottom_widget_area" /]
[post_comments /]
[post_article class="post-template-single"]
[post_header]
[post_title /]
[post_meta]
[post_date /]
[post_category /]
[post_tags /]
[post_author /]
[post_edit_link /]
[/post_meta]
[/post_header]
[post_body]
[post_thumbnail /]
[post_content /]
[clear /]
[/post_body]
[post_pagination style="margin-top:20px"/]
[/post_article]
[do_action action="dottoro_single_bottom_widget_area" /]
[post_comments /]
[post_article class="post-template-single"]
[post_header]
[post_title /]
[post_meta]
[post_date /]
[post_category /]
[post_author /]
[post_edit_link /]
[/post_meta]
[/post_header]
[post_body]
[post_thumbnail /]
[post_content /]
[clear /]
[/post_body]
[post_pagination style="margin-top:20px"/]
[post_footer]
[post_tags /]
[/post_footer]
[/post_article]
[do_action action="dottoro_single_bottom_widget_area" /]
[post_comments /]
[post_article class="post-template-single"]
[widget_area name="My Widget Area" /]
[post_header]
[post_title /]
[post_meta]
[post_date /]
[post_category /]
[post_author /]
[post_edit_link /]
[/post_meta]
[/post_header]
[post_body]
[post_thumbnail show_caption="true"/]
[post_content /]
[clear /]
[/post_body]
[post_pagination style="margin-top:20px"/]
[post_footer]
[post_tags /]
[/post_footer]
[/post_article]
[row style="margin:40px 0;font-size:15px"]
[col2 style="text-align:left;"]
[previous_post_link /]
[/col2]
[col2 style="text-align:right;"]
[next_post_link /]
[/col2]
[/row]
[do_action action="dottoro_single_bottom_widget_area" /]
[post_comments /]
[post_article class="post-template-portfolio-list"]
[post_thumbnail /]
<div style="padding: 0 6px;">
[post_header]
[post_title /]
[post_meta]
[post_date /]
[post_comments_num /]
[post_author /]
[post_category /]
[post_tags /]
[/post_meta]
[/post_header]
[post_body style="padding-top:0;"]
[post_content /]
[/post_body]
[post_footer]
[post_excerpt_tip /]
[post_read_more /]
[post_visit_site /]
[/post_footer]
</div>
[clear /]
[/post_article]
[post_article class="post-template-portfolio-list"]
[post_thumbnail /]
<div style="padding: 0 6px;">
[post_header]
[post_title heading_tag="h2" /]
[post_meta]
[post_date /]
[post_comments_num /]
[post_author /]
[post_category /]
[post_tags /]
[/post_meta]
[/post_header]
[post_body style="padding-top:0;"]
[post_content /]
[/post_body]
[post_footer]
[post_excerpt_tip /]
[post_read_more /]
[post_visit_site /]
[/post_footer]
</div>
[clear /]
[/post_article]