For help and information on installing plugins you can view our Installing WordPress Plugins Manual.
If you are using a Multisite please note: There are TWO ways to use CustomPress:
1. Network Activate. In the Network Admin>CustomPress>Settings Menu you will need to enable subsite contents. There will be two checkboxes there: first enables the Content Type menu on subsites in the CustomPress section. The second allows subsites to use any Network level defined custom types. When network activate you can define custom types at the Network level and these will appear on all subsites. If enabled you can also define custom types at the subsite level and they will be restricted to just that subsite.
2. Activate Site by Site. Each site creates their own content and it is restricted to that site.
Important: if you wish to allow the creation of content types on each sub-site when the plugin is not network-activated, you must first network-activate it and enable sub-site content types. Then network-deactivate.
Pay attention to the above: You cannot move content around after it has been created so you would have to delete and re-enter. In most cases you probably should not network activate and activate locally on those that need CustomPress.
Before starting with creating your post types and content you should do a quick layout of how you see your Post Type, Taxonomies and Custom Fields working together. This will save you time later. CustomPress is a pretty big plugin and has lots of features, you shouldn’t walk into using it without being prepared. To learn more about Post Types in WP CLICK HERE.
The Network Admin >Content Types menu is where you create your network content types.
Let’s create a Custom Post Type setup for a new website. This site is going to be a beginning gardening guide. So I’ll follow my own advice and make a list of what I’ll need to make this comprehensive.
Now that I know what I’m going to be doing let’s make a Post Type!
First things First! Name your post type, and be sure you like it. It cannot be changed!
Then you select the features that you want your post type to support. Title and Editor are defaults, everything else is up to you!
**Multisite installs can find the Content Types menu on the Network Admin
Quick Tour of the remaining settings:
- Support Regular Taxonomies: translates to “do you want to use the default tags and categories for this Post Type?”
- Capability Type: Should leave at default unless you know what you’re doing. If you want to learn more CLICK HERE.
- Map Meta Capabilities: More advanced stuff, default is good here too. If you want to learn about it CLICK HERE.
- Labels: What wording your post type will use across your site. Each has an explanation and a default value.
- Description: this one is easy! A summary of what the Post Type is (not required)
- Menu Position: Where it displays on the Dashboard Menu. Default is just above first divider.
- Menu Icon: Optional. Load 16px x 16px image into your media library. Copy the URL here.
- Display Custom Fields Columns: You’ll only see this once you’ve added custom fields to your post type.
- Public: You can choose to make the post type public or not. If you want granular control over the visibility you can set the following 4 parameters by selecting Advanced.
- Show UI, Show in Nav Menus, Publicly Queryable and Exclude From Search: will all be grey and will mimic the True or False setting in the Public menu option. They become individually changable when you choose Advanced in the Public menu.
- Hierarchical: Does your post type use a hierarchy? Regular Post Types don’t. If you’re doing a simple single post type, leave this False.
- Has Archive: determines if the post type is treated as having it’s own archive.
- Rewrite: allow permalinks to be rewritten at any time.
- Query Var: allows your post to be query-able <— is that a word? spellcheck says so, so I guess it must be…
- Can Export: another easy one, do you want to be able to export these?
PHEW! OK done with that! See not as hard as you thought, But you’re not done yet!
I need a way to categorize my Plant post type. So, I’m going to need a Taxonomy.
What kind of taxonomy you say? Well I will tell you! I use a hierarchical taxonomy (fancy phrase for Category!). I don’t need a non-hierarchical taxonomy (another fancy word for tags) because I am using the WP tags for this post type. Remember that “Support Regular Taxonomies:” setting? Aha! It’s making sense now isn’t it!?
So here I go with my Taxonomy
You’ve seen most of these settings already, so let’s pick out the one we haven’t touched on. They all tie in together so you’ll see the same rules as you saw in the post type, just applied to your taxonomy now.
Post Type: you will have to pick a post type to assign this taxonomy to. Yes you can select more than one. HOLD ON! I see those wheels turning, just stay with me! We have one more thing to do before we can start making custom posts.
Remember the Hierarchical setting here will determine if your taxonomy behaves like categories or tags.
OK last go round in Custom Fields
I actually have a few in my post type, but we only need to look at one, the settings are the same for all. It’s just how you use them that will change.
All that Embed stuff at the top is important, but we don’t need it yet, so it’s OK to skip over it right now. Just don’t forget about it!
Field Title: where you determine your title and if it’s a required field. You can also allow or deny other plugins or posts to use this field.
Field Type: Your entry method. Text, multi-line text, radio button, check boxes, drop-down select, multiselect and date picker, are all options. Just choose and add the options or parameters accordingly.
See, you’re a pro at this now, you already know what the last two fields do!
Now let’s check out what we have!
Content Part is done! Easy Peasy right?
Now to get it show up on our site to our users. Right now, we have lots of great info but it won’t display on the front end just yet. We have to add it to our page template. You can do this by using the Embed Code that is created when you create a new content type. Since the Post Type option uses the default Post values when created we don’t need to do anything special to get it to show. Here is a screenshot of what it looks like now:
As you can see, the Post Title , Content, Tags and default Post items are showing fine, but our Custom Taxonomies and Custom Fields are not showing. We will use the Embed Codes that were created when we created our custom content to get these to show up on the post page.
You will find the embed codes by hovering the item you want to add to the page template and clicking Embed Code. You’ll find this on both Taxonomies and Custom Fields, as well as some additional info on the Custom Fields tab about using these codes.
1. Embed code
You can use these Embed Codes 2 ways:
- Simply enter the shortcode created on any page or post, directly in the WordPress editor, or
- You can embed the php embed code in the page template so that you don’t have to manually add the shortcode to each post. To do this follow the instructions below:
First you need to find the page template you want to embed these into. You can create your own from scratch or you can copy your existing single.php and use the format “single-[post_type].php” . This is easily done by connecting to your site via FTP, opening your single.php template for the active theme in a Notepad editor (NOT WORD..if you need one try your built in Notepad or THIS) and ‘Save As’ the new file-name. Then just put it back in your theme folder via FTP.
There is a built in template creator that does what I have just described above, you will find it on the CustomPress>Settings menu. It only does what I have described above, it will NOT embed your custom taxonomies or fields. It’s best to do create the template yourself if you are comfortable doing so.
*NOTE: If you defined a rewrite slug in the post type, your naming format must be “single-[rewrite_slug].php”
Now we just embed the php codes in our new page template somewhere inside The Loop.
With Custom Fields you have the option of displaying your items all with one shortcode. This save the various entires that you need to make of each shortocode to display the Label and Value each individually.
Here it is in my template:
1. The loop
2. The shortcode
Save and upload the changes via FTP.
Now lets see how it looks on the site!
Not too bad! A couple of css tweaks and we’re looking good! Want to inspect the results? Visit the Demo site: custompress.co
CustomPress also provides a few additional Shortcodes, you can see these under the Shortcodes tab on the CustomPress menu (what? too obvious?) They give you a bit more advanced control over the Custom Field Input, Custom Field Filters and Custom Field Blocks.
And that’s it! Not so bad ‘eh?!