I created my first prototype for this custom software using Bill Erickson’s CRM. Seriously none of this would have been possible without it, because I was only vaguely familiar with custom post types and custom fields when I started and I would never have thought of creating custom meta boxes. Initially, I used the code created by Andrew Norcross to create custom fields and metaboxes, but for a non-developer like myself, it took me months to figure out how the code worked and how to modify it. And I never figured out how to create meta-boxes for more than one post type. Piklist made this process easier.
Now I can create a form field in Gravity Forms and map it to a corresponding custom field in WordPress. When a user submits the data, the metabox will be populated automatically so you can edit the data later.
Creating Custom Post Types for Orders, Clients, Proposals, etc. with Piklist
Piklist makes registering custom post types pretty simple and gives you additional options for displaying them in the admin backend, such as custom statues, custom columns, custom post title placeholder text, and the ability to hide post row actions, like quick edit. You could create custom posts the WordPress way, but you will lack these additional options. Simply drop the code into your functions file or into your plugin and modify to suit your needs.
Mapping Data Entry Form to Custom Fields with Gravity Forms and Piklist
Once you create a custom post type, you’re going to need to install the Gravity Forms + Custom Post Types plugin to map your data entry form to the right post type. To do so, use the POST TITLE field type and there will be a dropdown on the first tab.
To map to a custom field in WordPress you need to use the custom field option in Gravity Forms. You can use this for every kind of field you need and then change the field type to a paragraph, number, name, address, etc. from the FIELD TYPE dropdown. In the first tab, select NEW for Custom Field Name and enter in a field name, using underscores instead of spaces. Save the field name, you’re going to need it below.
Creating Custom Fields and Custom Metaboxes to standardize editing data with Piklist
To create a corresponding field in the WordPress admin, you will need to create a folder in your theme folder and call it piklist, then create a folder in the piklist folder and call it parts, then create a folder in the parts folder and call it meta-boxes so piklist/parts/meta-boxes is where your fields will live. You can also put the parts in a plugin, which is preferred so if you switch themes, you’ll still have access to the custom post types you created. Heres a folder reference in Piklist for themes and plugins.
You can do this by connecting to your site files via FTP or if your host has a file manager you can do so there. (Note than in the demo plugin, I created these files in the plugin folder instead of theme folder because it’s easier to share as a plugin.)
After you create the folders, create a new file in the meta-boxes folder. You can name the file metabox whatever you like. Paste in the following code to modify
To enter additional fields, just copy and paste the section above from // field starts to // field ends and paste it below the field, before the ?>. Make sure you enter a unique field name or weird things will happen and fields will start appearing twice. There’s all kinds of fields that you can create with Piklist with a lot of different parameters to correspond with the form fields in Gravity forms, including checkboxes, radio buttons, file uploads, etc. You can also create separate files in the meta-box folder so you can group fields into different meta-boxes.
Organizing Metaboxes into Tabs with Piklist
You can create workflows with Piklist so each step in your process can have a separate tab and you can put different meta-boxes in each tab.
You can also make certain fields conditional, so it will appear based on what is entered in another field. You can use this to create a workflow for your document creation process.
Generating Documents with Custom Single Templates
To use WordPress to organize data for reference and to produce documents, the first thing you need to do is create a form that creates custom posts and map the data to the fields in your post type then create custom single templates for each of your documents. In the demo plugin, I put these files in the plugin folder in a folder called templates.
To reference the custom field in the template, you can use Bill Erickson’s Get Custom Field function. Paste the function below in the functions file or plugin.
Then use this wherever you want to display the client’s name in the single template, for example.
In the sample below you’ll see that you can call a different template based on tag, category, user role, if the post is scheduled for the future…there is a lot of possibilities here. Just add a new elseif with the conditions.
Once you have all that created and you enter your contacts and their details, you can print off documents easily without having to bother with copying and pasting over data into a word processor. It will also ensure that all templates are standardized, so you don’t have your employees sending out unbranded documents that aren’t on the company letterhead. They can simply change the category or tag to access a different template.
Here is a sample Genesis template that is included with the demo plugin. This template generates a printable sheet for the client with their logo, color hex codes and more information. Note that if you do not have these custom fields created using Piklist it won’t display anything.