This tutorial will explain the different types of templates and how to create them.
Template assignment is probably the most complicate (or confusing) part in creating a template. You have to understand the different types of views and post types in WordPress.
WordPress Post Types & Taxonomies:
- Post = When you’re writing a regular blog entry, you write a post. By default, posts appear in reverse chronological order on your blog’s home page.
- Page = WordPress also refers Page as static page because it lives outside of the normal blog chronology.
- Custom Post Types = Custom post types are new post types that are created with custom functions, plugins, or themes. For example: when you install WooCommerce plugin, it will add various custom post types such as: Product, Order, Payment, Coupon, etc.
- Taxonomies = Taxonomies are like groups and types of the custom post type. For example: WooCommerce creates its own taxonomy for "Product Category".
Types of Views:
- Archive = Archive view of posts (eg. when you view a category page, that is an archive view)
- Single = Single view of a post
- Page = Single view of a page
Types of Templates
Flow follows the same logic as WordPress theme system and templates. So there are 3 main template types: Archive, Single, and Page.
- (1) Archive
- Categories = Template will apply to the checked category pages.
- Tags = Template will apply to the checked tag pages.
- Archives = Template will apply to the checked archives.
- Do not check "Apply to all" here, otherwise it will apply to all archive views of all custom post types (ie. if you have WooCommerce installed, it will apply to product archive views as well).
- If you intend to create an archive template for blog archive, just check the default WordPress archive views:
- Taxonomies = Template will apply the archive views of taxonomies.
- Again do not check "Apply to all" here, otherwise it will aplly to all archive views of all custom taxonomies.
- If all checkboxes are empty in Archive tabs, it will apply to all archive views of all posts, custom post types, and taxonomies.
- (2) Single
- Categories = Template will aply to the single post view of the checked categories.
- Post Types = Template will apply to the single post view of the checked post types.
- Do not check "Apply to all" here, else it will apply to all custom post type single view.
- If you want to create a single template for blog posts, simply check the "Posts" type:
- Posts = Template will apply to checked posts.
- If all checkboxes are empty in Single tabs, it will apply to all single views of all posts and custom post types.
- (3) Page = Template will apply to the checked pages.
- When 2 or more templates are assigned to the same views/conditions, the latest created template will have the priority.
- You can also enter the "Template Priority" in Template Options to override this. This allows you to override the template for a specific views (ie. you can create a generic template that applies to all pages, then override a specific page with another template).
- If no template assigned, it will fallback to the PHP templates from the framework (on the frontend Flow Menu, if you don’t see the "Edit In-use Template" link, it means the page that you are viewing has no template assigned).
To Create New Templates
- Go to WP-admin > Themify Flow > Templates > Add New
- On the Template Options lightbox:
- Name = Input a template name
- Header = select whether to include header
- Sidebar = select whether to include sidebar
- Footer = select whether to include footer
- Type = refers to the type of templates used for rendering the page in different views (Archive, Single, and Page)
- Archive refers to the default home page, category, search, archive, and tag pages, etc.
- Single is the post page (also known as "Single").
- Page is the static page.
- Assign template to = refer to "Template Assignment" for this option
- Custom CSS Class = optional CSS class that you want to add in the template <body> class (refer to Custom CSS Class for more details).
- After you complete the template options, click "Add" and it will direct you to the frontend template Builder mode with live preview.
- By default, it will auto pull in the default Header, Sidebar, and Footer template part. If you want to have a different header, sidebar, or footer: first create a new Template Part and then swap the template part in the template (click on the "swap" icon to swap template part).
- NOTE: the content on the preview are for preview only, they might be different than the actual page result. To see the actual result: close the template Builder and go to the actual page view.
To Edit Templates
- Go to WP-admin > Themify Flow > Templates and you should see a list of all templates
- Hover over the template name on the list and click either:
- Edit = edit in backend mode
- Edit on Frontend = edit the template using the frontend Builder
The module category tabs will automatically selected base on the template type (ie. if it is a Single template, then it will show the modules that are relevant to single view).
- Global = Global modules such as Site Logo, Tagline, Menu, Widget Area, etc.
- Archive = Modules for archive template such as Category Title, Category Description, and Archive Post module.
- Single = Modules for single template such as Single Post, Comments, Author Box, etc.
- Page = Modules for page template such as Page Title and Page Content.
- Content = Static modules that can be used anywhere (such as Text, Image, Video, etc.).