JetEngine makes it possible to manage the parent/child and grandparent/grandchild relations between different types of data (WordPress Custom Fields in CPTs, CCTs, taxonomy items, and users). It can connect/sort/filter/search related items on the front end (with other JetPlugins) using JetFormBuilder, apply filters to relations and different macros to output the related objects’ data in listings, and develop CPT relations in REST-API.
- JetEngine plugin installed and activated;
- Elementor free version or Block Editor;
- configured two custom post types.
The current version of JetEngine maintains both the refactored features of Relations for Post Types (which stays as a legacy one) and new features available for users, taxonomies, and CCTs. Also, you can add meta fields to the relations and directly create or connect child and parent items from the related items’ editing areas.
To find the Relations tab, navigate the JetEngine plugin menu in the WordPress admin dashboard.
Here you can update the relation settings by hitting the “Clear the legaсy data” button. After that, all posts will be automatically transferred, but you must manually change macros used for relations.
The Relations tab has the following settings: General Settings, Labels, and Meta Field. Let’s look at the General Settings in more detail.
Currently, there are 14 General Settings in this block. They are:
- Name to set a unique name for the current relation that will later be shown in macros and dynamic tag settings. JetEngine does not limit the number of characters for this field and allows the use of spaces and punctuation marks.
- Parent object to select the main object (post type, taxonomy, user, or CCT) for current relation. You can choose one from the drop-down menu. So, keep in mind that you have previously created the parent object.
Check the detailed information about relation types through our tutorial How to Choose and Set Post Relations (Legacy).
The following settings are toggles to turn on/off the appropriate functions.
- Register controls for parent object to add a user interface (UI) to manage related items on the parent object editing area (e.g., on the editing areas of the post, user, and term).
- Allow to create new children from parent to create new child-related items from the parent object editing page.
If you turn on this option, a page you edit will look as follows 一 you will be able to add child CPTs (i.e., Tour) to the parent CPT (i.e., Country).
Content Type Related Settings
If you select a CCT as a parent or child object, a block with the following settings appears below the General Settings:
- Title field. Pick a CCT field from where the titles will be taken for the related items when you connect a new related item;
- Create fields. Here, you can choose the CCT fields to fill when creating a new child CCT item on the parent editing page or a new parent CCT item on the child editing page.
To learn more about the related Custom Content Type items, check this tutorial.
In the Labels block, you can set how relation settings will look in the dashboard. The Labels for the parent or child objects will appear if you enable the Register controls for parent/child object toggle. Also, some labels are dependent on the Allow to create new parents/children from children/parent toggles.
- Parent Object: label of relation box. It’s a custom label for the relation box on the parent object editing page;
- Parent Object: label of connect button. It’s a custom label for the button for connecting related items on the parent object editing page;
- Parent Object: label of select item control. It’s a custom label for the control for items selection on the parent object editing page;
- Parent Object: label of create button. It’s a custom label for the button for creating related items on the parent object editing page;
- Child Object: label of relation box. It’s a custom label for the relation box on the child object editing page;
- Child Object: label of connect button. It’s a custom label for the button for connecting related items on the child object editing page;
- Child Object: label of select item control. It’s a custom label for the control for items selection on the child object editing page;
- Child Object: label of create button. It’s a custom label for the button for creating related items on the child object editing page.
For example, we have created the relation, where users are the parent object and pages are the child object and added such Labels.
Let’s proceed to the child page. Here we can see the list of the parent items and create and connect them if needed.
Once we hit the “Connect” button, the pop-up with the select item control will appear.
Such settings are analogous to those on the parent object page, where you can see, create and connect the child items.
The meta field functionality is the same as in the post types, taxonomies, and meta boxes, but not all the field types are available because they are not compatible with the UI due to restrictions.
After creating meta fields and ending with other relation settings, click on the “Publish Relation” or “Update Relation” button. Then proceed to the child or parent editing page (for instance, we have navigated to the provider post type and hit the “Edit” button of one of the posts).
Push the button of related item creation or connection. In the first pop-up, you will need to enter the name of the created item or select the title of the connected one. In the second pop-up, you can fill the meta field data.
Also, to fill the meta field, you can press the “Edit Meta” button. Here you get the same pop-up, as on the previous screenshot, where you can edit or enter new meta data. After you finish, click on the “Save Meta Data” button and close the pop-up.
If you end, update, or publish the object (post, CCT item, term, etc.), which you edited.
Press to edit a Single Page or Listing Item via the Elementor or Gutenberg editors and drag-n-drop the Dynamic Field widget or block to display the meta fields of related items. Select the “Relation Meta Data” Source and the name of the needed Meta Field. Lastly, select the “Related Items From…” Context.
There are the same settings in the Dynamic Field block in the Gutenberg editor.
We have placed the meta field on the Parent Single Page and in the Listing with the related children items.
To display only the related children service posts below the parent provider post we have used the Post Type Query with the Related Items macro in the Listing Grid.
To apply the query to the Listing Grid proceed to the Custom Query section in the widget Content settings, enable the toggle and select the query for relations.
To learn more about the query and macros for relations, proceed to this tutorial.
To organize your posts more appropriately, you can display the related items in the Admin Column in the CPT.
Go to JetEngine > Post Types and click the “Edit” button near the needed CPT. “Add new” admin column, give it a title, and select the “Custom Callback” Type. Click the “Select from existing callbacks” line in the Callback field.
In the appeared window, select the jet_engine_custom_cb_related_items callback.
Choose the relation for this admin column in the next window and tick the “Apply” button.
“Update” the CPT, proceed to the post type tab on the WordPress Dashboard and check the admin column with the related items.
With the Admin Filters feature, you can filter the posts list by the related items.
Go to JetEngine > Post Types and click the “Edit” button near the needed CPT. “Add new” admin filter, give it a name, and select the “Filter by related items” Type. In the new Relation field, select the needed relation.
“Update” the CPT, proceed to the post type tab on the WordPress Dashboard, and filter posts by the related items.
That’s it. You know now all about the JetEngine relations feature settings and how they can help you create or connect the related items on the parent or child editing page.