Post Type Builder Plugin

About

Post Type Builder (PTB) is a WordPress plugin that allows you to create custom post types with a custom meta box, taxonomies, and post type templates.

Installing the Plugin

To install the plugin:

  • First, you will need to download the plugin zip file from the Member Area on the Themify site.
    • Note: Some browsers (e.g. Safari) may auto-extract zip files. Right-clicking on the download link and selecting "Save Linked File As" will allow you to download the ZIP version.
  • Then go to your WP Admin > Plugins > Add New > Upload Plugin.
  • Now upload the plugin zip file and click "Install Now".
  • After the plugin is installed, click "Activate Plugin" to activate the plugin.

install-plugin

FYI: If you can't install the plugin using WordPress plugin installer, you may also use a FTP software to install the plugin. To install plugins with an FTP method: extract the plugin zip on your local computer then upload the plugin folder to your FTP server where you installed WordPress > wp-content > plugins folder. Then login to your WP Admin > Plugins to activate the plugin.

Importing Sample Post Types

The plugin folder comes with some sample post types (created using the plugin) and some sample posts as showing on our demo. These sample post types might guide and help you better understand how to use the plugin.

To import the sample post types:

  • First extract the post-type-builder.zip file to your local computer (you may download the plugin zip from Member Area). You should have a plugin folder named "themify-ptb" (we will use this folder later on to import files).
  • Then go to WP-admin > Post Type Builder > Import/Export
  • Under the Import section, upload the 'ptb-sample-post-types.json' file from the plugin folder "themify-ptb folder > sample folder", and click "Import".
  • This will add new post types added on your admin sidebar menu
  • NOTE: this only imports the custom post types created with the plugin, not the posts. To import the sample posts, follow the next step.

import-sample-post-type

To import the sample posts:

  • NOTE: To import the sample posts make sure to import the sample post types first (refer to the instruction above). Otherwise, it will give you error saying post type(s) do not exist.
  • Go to WP-admin > Tools > Import
  • Click WordPress (if you are prompted to install the importer plugin, do so)
  • Upload the 'wp-sample-posts.xml' file from the plugin folder "themify-ptb folder > sample folder"
  • You will be asked to map a user to the content and import the file attachments. Check "Download and import file attachments" to import the placeholder images.
    • If the content don't seem to import, try to import again without checking "Download and import file attachments" checkbox.
  • Now you may edit or delete the content as you like.

import-sample-post

Step-by-Step Overview:

  1. Create a new Post Type
  2. Create Templates for the post type
    • Edit the Archive Template
    • Edit the Single Template
  3. When you are done with the post type and templates, you'll be ready to add custom posts
  4. After custom posts are added, you may use the shortcode generator to display custom posts on any post/page
  5. With WPML plugin (not included in the plugin), you may create additional multilingual posts

Post Types

Custom Post Type is the additional post types created in addition to the standard WordPress post types such as Post and Page.

To create a new post type:

  • Go to WP-admin > Post Type Builder > Post Types > Add New
  • Singular Label = Singular descriptive name of the post type (eg. Movie).
  • Plural Label = Plural descriptive name of the custom post type (eg. Movies).
  • Post Type Slug = Post type slug which is used in permalink (friendly URL structure).
    • NOTE: Below are a few post type slug restriction.
      • You cannot use the following slug names: Menu, Posts, Pages, Action, Author, Order, Theme. These are default post types reserved by WordPress. Click here to find the complete list of default reserved post types by WordPress.
      • Slug names have to be lower case, no space, unique, and written only in English characters
  • Description = This description will appear on the "Post Types" lister where you see all the post types created with Post Type Builder (PTB).
  • Supports = These are the standard WordPress post features. Check which one(s) you want to enable the feature support.
  • Taxonomies = Taxonomies are like groups and types of the custom post type. For example, if you are creating a "Movie Review" post type, you would need taxonomies like Actors, Directors, Genre, etc.
    • NOTE: If you are going to assign custom taxonomies with the post type, create the taxonomies first before adding the post type. If you forgot to create the taxonomies, you can always come back and edit this. Read the Taxonomies section for more details.
  • Custom Labels = In Custom Labels panel, you can enter the label text used in WordPress admin interface. You may leave the labels as default or enter your custom labels.
  • Advanced Options = In Advanced Options panel, you can specify the advanced options. Generally, it is fine to leave everything as default.

add-post-type

Meta Box Builder

WordPress post types only offer the standard fields such as title, content, featured image, etc. Meta Box allows you to insert custom fields that are tailored to the custom post types. The fields you create here will appear in the Meta Box panel when users add/edit a post. For example, if you are creating a "Property Listing" post type, you would need meta data like: price, size, area, lot size, property taxes, etc.

To create fields in Meta Box:

  • On the Meta Box Builder, hover the "Add Field" button and click on the field type insert.
  • Then enter the field name, description, and options of the field. Refer to "Meta Field Types" below to learn how each field type works.

meta-box-builder

Meta Field Types:

  • Text = Allow users to enter text input
    • Repeatable = Allow users to enter multiple text in the same fields.
  • Textarea = Allow users to enter a large block of text
  • Radio Button = Allow users to select one radio option in a group of radio options.
  • Checkbox = Allow users to select multiple options (difference between radio and checkbox is radio only allows one selection whereas checkbox allows multiple selections)
  • Select = Allow users to select an option from a dropdown select (if you have a lot of options, it would be better to use select dropdown instead of radio buttons because radio buttons might take a lot of space in the meta box).
  • Image = Allow users to insert/upload an image.
  • Link Button = Allow users to enter a link button with custom link text.

meta-field-types

Templates

Templates are the layouts that your post type will appear either on archive or in single view. When you finish adding a new post type, you will be redirected to create a template for the new post type. After entering the template name, you will be redirected to edit the post type archive and single template.

  • Template Name = Enter the name of the template (eg. Movie Template)
  • Template for = Select the post type which this template should be used for (eg. if you are creating the movie template, then select the "Movie" post type).
    • NOTE: To avoid template errors, only one post type is allowed to assign in each template. If you see the select option is grayed out, it means there is already a template assigned to that post type. Once the template is created, the template assignment is not editable. You would need to delete the template and redo the template again.
  • Edit Archive Template = Archive template will be used in archive views of the post type
    • Example of archive views:
      • Category/taxonomy views of the post type.
      • When you use the PTB shortcode to display the posts, archive template will be used.
    • Archive Template options:
      • Post Layout = Display the posts in either list-post, 4-column, 3-column, or 2-column
      • Posts per page = How many posts to display per page
      • Orderby = How the posts should be ordered/sorted (default is ordered by post publish date)
      • Order = Whether to display in descending or ascending order
      • Pagination = Whether to display the pagination
  • Edit Single Post Template = Single post view of the post type.

post-type-template

Template Builder

The Template Builder smartly loads only the enabled supports (title, content, featured image, etc.) and the associated modules that you've created in the meta box.

Using the Builder:

  • To drop in modules: drag the modules to the placeholder grid and then enter the module options.
  • To set the column grid: hover the column icon located on top-left corner of the row top bar and select the layout as you like.
  • To new rows: click on "Add Row" button.
  • To move the modules around, drag and drop the active modules around within the grid.
  • To collapse/expand the active modules: click on the arrow up/down icon
  • To delete an active module: click on the X icon

ptb-template-builder

Module Options:

  • Text Before = This text will be added before the output (great for using as labels)
  • Output Tag = The HTML tag that will be used to output
  • Text After = This text will be added after the output
  • Display Inline = If Display Inline is checked, the module will have left float, so the next following modules will display next to it (ie. instead of displaying the module in a new line, it will display in one-line).
  • Note that the other options may vary depending on the field types you created in the meta box.

Taxonomies

Taxonomy is a grouping mechanism for custom post types (ie. it is used to add custom categorization/grouping). For example: if you creating a Property Listing post type, you would need taxonomies like property types, number of rooms, parking spaces, and baths.

To create a new taxonomy:

  • Go to WP-admin > Post Type Builder > Taxonomies > Add New
  • Singular Label = Singular descriptive name of the taxonomy (eg. Property Type).
  • Plural Label = Plural descriptive name of the custom post type (eg. Property Types).
  • Taxonomy Slug = Taxonomy slug which is used in permalink (friendly URL structure).
  • Attach to = Check the post type(s) that you want to assign this taxonomy to (then the taxonomy meta box will appear in the post edit/add screen).
  • Custom Labels = In Custom Labels panel, you can enter the label text used in WordPress admin interface. You may leave the labels as default or enter your custom labels.
  • Advanced Options = In Advanced Options panel, you can specify the advanced options. Generally, it is fine to leave everything as default.

custom-taxonomies

Displaying Posts with Shortcodes

PTB plugin comes with a shortcode generator which allows you to display the custom post types anywhere by using shortcodes.

To generate shortcodes:

  • Add any post or page, on the editor, you should see the PTB Shortcode button
  • Click on the PTB Shortcode button and click the post type that you want to display
    • NOTE: if you don't see this PTB Shortcodes button or if certain post type(s) is not on the list, it means the post type does not archive view enabled (you may enable archive view by editing the post type > Advanced Options > Has Archive = Yes) or the post type is missing PTB Template (you may create a PTB Template at Post Type Builder > Templates > Add new)

ptb-shortcode-generator

Shortcode options:

  • Orderby = How the posts should be ordered/sorted (default is ordered by post publish date)
  • Order = Whether to display in descending or ascending order
  • Pagination = Whether to display the pagination
  • Style = Post style (display the posts in list-post, 4-column, 3-column, or 2-column)
  • Note that the other shortcode options may vary depending on the taxonomies that you created.

Import / Export

You may use the PTB import/export tool to transfer post types, taxonomies, and templates from one site to another that uses the same plugin. You may also use it for backup purposes.

To Export:

  • Go to WP-admin > Post Type Builder > Import/Export
  • You can export data separately or together:
    • Export Post Types and its associated Taxonomies & Templates = Post types and associated taxonomies and templates will be exported tegether.
    • Export separately = All post types, taxonomies, and templates will be exported separately.
  • Check the post type(s) that you want to export and then click "Export" (then it will prompt you to download a .json file).

To Import:

  • On the PTB Import/Export screen, under the "Import" section, upload the .json downloaded previously and click "Import" button.

ptb-export-import

WPML Integration

With the WPML plugin and additional languages enabled, you will be able to create multilingual post types.

To use with WPML:

  • Install a copy of WPML plugin (not included in PTB plugin).
  • With WPML plugin activated, go to WPML > Languages, click "Add / Remove languages" and check the additional language(s) that you would like to enable
  • After the languages are added, you will see the additional language flag icons above each input. Click on the flag icon to switch the input to the selected language.
  • WPML doesn't automatically translate all your content for you. You will have to manually input the translated content on each field where there are flag icons. This includes:
    • Post Type Singular and Plural labels are mandatory (description is optional)
    • Meta box labels
    • Taxonomy Singular and Plural Labels
    • Text Before and Text After labels on templates
    • Individual posts
  • WARNING: Renaming your post type slug after you've added multilingual posts with WPML, it will merge all your multilingual posts to English due to the way WPML handles the posts.

ptb-wpml-input

Notes:

  • If you enable multiple languages in WPML, the post type Builder required fields are required for all languages that you enabled.
  • If you enable WPML mutliple languages after the post type and meta box is already created, you might see empty labels on WP admin interface and meta box. Simply edit the existing post types and enter the missing language inputs.
  • WPML Import/Export Issues: When using "WP > Tools > Export" to export the multilingual posts created with WPML, the posts will be merged as English after import. Even if your post is in another language it will sort the post as English.

Disable the automatic update

To disable the update notifications and automatic update features, add this to your theme's functions.php file:

<?php

function custom_disable_ptb_updater() {
    remove_action( 'after_setup_theme', 'themify_ptb_start_updater' );
}
add_action( 'after_setup_theme', 'custom_disable_ptb_updater', 1 );

Note that this disables the automatic update for PTB addons as well.

Father's Day Sale: Get up to 30% off code: SUPERDAD & $100 off Lifetime Club with code: DAD4LIFE