Skip to content

Creating a Post Type

Radoslav Georgiev edited this page Oct 21, 2018 · 3 revisions

Intro

You can create a new post type by navigating to Ultimate Fields » Post Types in the admin.

upt-intro

Below you can find an overview of the fields on the page.

Slug & Labels

Slug is the slug that the post type will be registered with. Later, it will be used for querying the posts of the post type, as well as the default URL rewrite rules.

Icon is the icon, which will be shown in the dashboard menu.

Plural name and Singular name will be used to generate the labels for the post type by replacing them in all needed strings. You may choose to Fine-tune labels if you would like to enter specialized strings for any of them.

General Fields

This section allows you to toggle flags & settings for the post type. Please read the Function Reference/register_post_type article at the Codex to read about those settings.

URLs

If you choose to Enable URL rewrites for the new post type, you an adjust what slug should be used for it and whether the blog front should be used or not.

Fields

The Fields tab allows you to quickly add fields to the newly created post type.

Consider this a shortcut method: You may still create a new container and manually assign it to the new post type, but the "Fields" tab requires less steps to do so. The downside of using it is that the fields, which you create, will be shown without the ability to select any location rules for them.

Appearance

This tab allows you to:

  • Select what template to use for the post type. You may choose to use the existing template of an existing post type (like posts).
  • Content to display before the standard content of the post type, as well as content to display after it.

You can use the [value] shortcode, provided by Ultimate FIelds to format the data here. It accepts the same arguments as the_value and loads them for the current post.

Example for the Before Content field:

<p>This event starts on [value key="event_start"] and finishes on [value key="event_end"].</p>
Clone this wiki locally