PTB Relation

About

The Relation addon is a WordPress plugin that works together with the Post Type Builder (PTB). It allows you to create a link (relation) with 2 custom post types. How it works is that it gives you the ability to query post type (A) while user is viewing post type (B). It's built with its own relation template allowing you to customize how it looks when being queried.

PTB Relation Addon sample image preview

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.

How It Works

Note: This plugin will not work without the Post Type Builder (PTB) plugin activated.

  • First make sure Post Type Builder plugin is activated
  • Then install and activate the Relation addon plugin.
  • Go to your WP Admin > Post Type Builder > Post Type. Then edit a post type you've created with PTB, or create a new post type.
  • On the Meta Box Builder add the new Relation module.
  • Enter the field name, description, and the custom post type that you would like to link it too. Note: Once you've selected a post type, you cannot change it to another post type. You'll have to add a new Relation module to change the post type. This is to avoid any conflicts.

PTB Relation Addon module meta box image preview

Relation Template

Relation template depicts relation post layout. Similar to how you build a PTB Template, you can also build a custom Relation Template by dragging and dragging the modules that are built with the post type.

  • Go to your WP Admin > Post Type Builder > Relations Template.

PTB Relation backend navigation on how to create a template

  • You'll see a default template created with the metabox you've created.
  • Edit the template, and drag and drop the modules that you would like to appear as your custom post query on the related post type.
  • This template will appear on the post type where you've placed the relation module.

PTB Relation Addon template builder

Import/Export Templates

You can import/export relation templates by clicking on the "export" button on each of the posts, and the "Import" button above.

how to import/export ptb relation templates

Disable the automatic update

<?php

function custom_disable_ptb_relation_update() {
    remove_action( 'ptb_check_update', 'ptb_relation_update' );
}
add_action( 'plugins_loaded', 'custom_disable_ptb_relation_update' );

Celebrating our LUCKY7 Anniversary with a 50% Sale + 7 Lifetime Club Giveaway! Submit entry here