Forking an Email Template

What is Forking?

What do we mean by forking? Forking in this case means to create a new template based on another template that already exists.

Step I: Find the template inside your file manager

When we browse inner WordPress files we usually use FTP, but some will use a browser file manager provided by their hosting provider.

Locate the Template

For this example we will fork a template included in our core Inbound Pro plugin. Use your file manager to locate this template:

 /wp-content/plugins/_inbound-now/core/inbound-email/templates/inbound-now/

Copy and Paste Template Directory into Uploads Folder

Copy:

/wp-content/plugins/_inbound-now/core/inbound-email/templates/inbound-now/

And paste it into:

/wp-content/uploads/inbound-email/templates/

And then rename the directory ‘inbound-now’ to ‘inbound-now-forked’

Step 2: Edit config.php file

Edit Template Label

Open this file in your favorite text editor:

/wp-content/uploads/inbound-email/templates/inbound-now-forked/config.php

Find the code that looks like this:

/* Configures Template Information */
$inbound_email_data[$key]['info'] = array(
    'data_type' => 'email-template',
    'label' => __('Inbound Now', 'inbound-mailer'),
    'category' => 'responsive',
    'demo' => '',
    'description' => __('An email template in the style of Inbound Now emails.', 'inbound-mailer'),
    'acf' => true
);

And update it to have a new label for identification:

/* Configures Template Information */
$inbound_email_data[$key]['info'] = array(
    'data_type' => 'email-template',
    'label' => __('Inbound Now Forked', 'inbound-mailer'),
    'category' => 'responsive',
    'demo' => '',
    'description' => __('An email template in the style of Inbound Now emails.', 'inbound-mailer'),
    'acf' => true
);

Make Field Keys Unique

If you run a text search in config.php for

'key' =>

you will see a handful of unique key values that defined the template’s field inputs. These key values cannot be the same as other templates so we need to make them unique.

For example, we will change the first occurrences as so:

Before

/*
* Define ACF Fields to be used in this template
* Pay special attention to the 'location' key as this is where we tell ACF to load when this template is selected
*/
if( function_exists('acf_add_local_field_group') ):

    acf_add_local_field_group(array (
        'key' => 'group_56b8eedbdc29b',
        'title' => 'Inbound Now Email Template',
        'fields' => array (
            array (
                'key' => 'field_56b8f76766d7c',
                 ......

After

/*
* Define ACF Fields to be used in this template
* Pay special attention to the 'location' key as this is where we tell ACF to load when this template is selected
*/
if( function_exists('acf_add_local_field_group') ):

    acf_add_local_field_group(array (
        'key' => 'group_56b8eedbdc29bfk',
        'title' => 'Inbound Now Email Template',
        'fields' => array (
            array (
                'key' => 'field_56b8f76766d7cfk',
                ...

Notice we added ‘fk’ to the end of each key string. Now we will continue to do this for every key inside config.php until all keys have been made unique.

Step 3: Editing Index.php

Now that we’ve prepared our new forked template’s config.php file we can edit our index.php file to our liking, changing whatever we want inside the template to meet our desired standards.

See:

/wp-content/uploads/inbound-email/templates/inbound-now-forked/index.php

to begin editing.