Create Custom Post Types with the CPT-UI plugin

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we are looking at how to configure the custom post type UI plug-in this is a free plug-in from the WordPress repository that not only allows you to quickly create custom post types but also custom taxonomies to go with them it's a really easy and handy plugin but on first sight it can appear to have an overwhelming number of options luckily most of those options you will not need to touch so I thought it might be helpful if I shared with you how I set things up and share some of the tips that I've learned along the way now if all of this is sounding like gobbledygook to you let me quickly say that blog posts are post types and WordPress tags and categories that go with those are tax on amis so in the example I'm going to show you I want to set up a product custom post type so I can separate my product posts from my blog post and give it its own taxonomy which I'm going to call types but I easily could have called it product tags or product categories so I'm going to get off camera and we'll get started so I'm here in the backend of my dummy product site and I've already installed the custom post type UI plug-in from the WordPress repository and if I activate this now you'll see that it'll add a new menu item to the dashboard and if I go over to the first link here add Ford / edit post types and click on that this will take me over to my first settings now in fact we only need to fill in this basic settings area these three fields although there are a ton of options over here the plug-in will select what it thinks that we need so let's just see what that offers so we'll go in and fill in the slug first which I'm gonna call product now the slug is what's going to appear in the URL so here it's gonna be my domain name forward slash product forward slash whatever the URL is of the that I place under this custom post type and we'll need to add some labels as they show over here so it's asking for a plural version and a singular version and I'm going to add that post type so we can see what happens so what is done is just below comments here it's added a custom post type it's given it the WordPress - icon the default one for posts so it's the same as they post over here and let's take a look at what it's given as in terms of our fields when we try and create a new post so here we are we've got the title as we're used to the edit area and we've also got a place to add in our featured image and you may not see this but we've got slug as well which goes with the title and we'll just check our screen options to make sure there's nothing else hidden nope that's everything and in most cases this is probably enough that's the first custom post type created but in this case I want a little bit more in here I want to bring back some other options that are in WordPress I want to bring back revisions so I can reset things I want to bring in custom fields as well so I can use that to add in my prices against my products I think I'm gonna add in author as well because I might decide to call some of the authors by brand name so I can attach those to different posts and display those in a different way and probably that's it we'll have a look later so I'm gonna do that I also would like to move this up closer to the top because I think this is going to be more important on this site and I'd like to change the icon to something meaningful so you don't get confused which one you're looking at so that's what we're gonna do and finally I'm going to do one other thing which is change my slogan I use product but I want to change this products now the reason is is that I did a video before this showing how you could create your own custom post type plug-in so I've already pre-populated this with some posts and product posts against the slug of products but I wanted to do this just to show you what it is blank and also show you a little tip as well so I'm gonna go down back to add for / edit post types and we'll see that we've now got the option to edit this so I'm going to do this and I'm never 100% sure how this is going to behave so if I want to change this let's see what actually happens so we get that that's interesting so it's given us this already now sometimes I believe if I migrate it brings everything over but what I'm gonna do is I'm gonna try and just save this as it is I believe if I don't migrate it will give us both options let's just see what actually happens okay it created it successfully oh no aha it did create it so we've got two products now what we don't want that you can find I think if you migrate one you're changing as well you can find that you get a little error that comes up saying it already exists because it get confused I think with the labels here if you just started here's my little tip I only found this recently if you want to clear everything what you can do is to go over to tools and go over to the import section here so this is really handy in the tools here we can actually import and export these and save them and put them on to a another site if we want to also we've got a get code option so if we want to place the code that we generate here into functions.php file in our child things we can do that as well but let me just show this little tip you'll probably be able to remember this as I have it we just need open and close curly braces and then in between that we need double quotation marks and if I click import now it's gonna reset everything can clear it you can do the same on taxonomy x' here but i believe that it will clear everything so you probably don't want to do it unless you'll just start him out okay so let's go back and we're gonna start afresh i'm going to this time call this products we need products there we need product I'm going to add it and we'll go over to the Edit post slides so we can see it's back over here and in fact actually it's just show you that I do have some my other stuff in the database there we are it's all showing up now let's go back edit post right so let's try and make some of these changes here I can't cover everything here but because it kind of sets our labels up for us we don't really need any additional labels so I've never found a need to change this so I'm gonna just minimize that to get that out of the way and then we'll move on to our main section now for making changes and this is on the settings so these first ones I never touch I want everything to be public and show in the UI I want it in my navigation memory I don't touch the rest API so I move past this this is the first one that I usually need to change and this is has archived is set to false so if I was to go to my URL and put products over here it's going to give me a 404 page as it is because it's not creating an archive for this is quite handy in a lot of cases you probably just saw that I'd been playing around with staff as a custom post type and in that circumstance I might not want an archive for staff I might just want to have individual staff pages and display the staff on another page not have an archive page as such so this is quite a good option to be set to false but in this case I do want an archive page for my product so I'm going to change that to true I do want it to be included in my search so I'm not going to exclude it I'm gonna leave this capability type to posts hierarchical I don't need a child and parent relationship for this custom post type I am NOT going to rewrite any of the slugs here and all of this stuff anonymously I don't understand it so I don't touch it the first thing I come to is generally the menu position where I do want to old this now what it does do is give you a link so you can see how you have to scroll down a little bit for this over here gives you some idea of where things are position so they're going from five to 100 where you can change things actually you can go above five let me just go back and explain this I wants to mention as well that I have got a blog post as well to go with this and as you can see I've added another form of this over here and I've got all my notes here so I'm gonna add the video to this and publish it when it's done right let me go back what I typically do if I want it to be at the top here is I put in 6 here because posts are at number 5 and then 6 it will fall just below posts if I try and put 5 here it will still fall below posts if I try and put 4 in it will still I believe fall below posts because that's where the separator is which is just creating this space over here so it's only when I add 3 that I can get it above post and it's going to be above the separator so it looks a little bit odd being so close to the dashboard and being away from posts so I kind of put up with the fact that it has to come after post which maybe not ideal but that's what I'm doing maybe somebody knows I'm sure there are other ways to change things around but I'm not going to bother it's not that important to me wanted to show it in the menu of course I'm leaving all of that and I do want a new menu icon so we've got a choice here we can either add our own image icon or we can use a dash icon class which is what I do so let me just mention about the images because I don't think this is the ideal way to do it you definitely need to make sure that you get the right sizes they also throw things out but I've noticed that these have changed in the time that I've been using this I'm sure it used to be 16 by 16 so I'm not sure how that might throw things out and also you have to be a little bit conscious about the fact that users can now change their color schemes here so now I've got one so I'll just show you how this works so here's one I've got to the right size 20 by 20 I'm going to insert that now I'm gonna have to save this now just so you can see it and we're still in the same position there we are now this kind of blends in okay here because it looks great but in fact it's white and the reason is because it's got some CSS overlay with the color scheme that's here so you would need to pick white if you wanted it to work with the defaults here it's not perfectly aligned here as you can see and you'll notice here they just have the same hover over effects so if I used a dash icon I'm just going to it's just gonna blend in with the right rollover so you have to kind of make a few adjustments there also like I say if your users are going to go in let me just go into my user settings here and change my color scheme to something else you can see it's not kind of working very well it's almost disappeared until I hover over so these are just things to be aware of there right let me just go back to where we were editor area okay let's go back down and we need to move this out now it's gonna delete this oops the rest of it and it doesn't give us a link to - icon classes but if you just google that you're going to come over to here and you could just grab this text which I've got to do here cuz I've already got it set on the one that I want I want my cart and you've got quite a few options over here so let's go over here and taste that in so that's done have a left of space there I have okay and now we'll move on to our support section here as mentioned I want to add in custom fields for my price I don't want comment so do what revisions I decided I might go for author here and maybe I'll go for excerpts that I can have something different show on the archive page - what I've pasted in the main editor and that's probably it if I my theme supported having some different templates I might want to take this which means that if I added that I'd be able to select what layout I'm gonna have for that particular post but I'm not gonna do that here I'm gonna have one layout and this is something which maybe some will not be so familiar with there was a time when WordPress took some influence from tumblr and it allowed you to be able to sort of markup your posts as either videos or quotes or audio or regular posts and if your theme supported it then it would display those in different ways but it's kind of something that's died out so I'm never taking that okay I don't touch this not even sure what it is and here we have built in tax on them is I'm never sure why we have this extra categories over here but these are the default so if I was to tick these on now they would appear under here as my options as we see them in post-oil and up with categories and tags but I would be sharing these with my posts so I don't want to do that I'm going to create my own in this video so we're done let's save this and see that everything's as it should be there we are I've got my products here and all being well everything that I placed in their previously should be there perfect I've got my price custom fields over here that's done so we've done that that's one other job that I need to do now and let's create my taxonomy so it's fairly easy from here we've got a new section for add taxonomy so I'm going to add that one in here and this is quite a bit more simple I'm calling this types I believe and I'm going to go for the plural of types here and also for type here and then it's just a case of deciding what I'm going to attach those twos now I've already create did products I can attach that over here and I'm not going to bother again with any labels because I never do and there is just one other decision I typically need to make here all of these are showing I want those I don't bother with variables don't need to rewrite any of these typically the only thing I need to do is it's here somewhere hierarchical that's the one this is set to false so this is going to behave and show itself exactly as web press tags do in posts I want to have it work more like categories so I can have a parent-child relationship if I want and also it displays it in a way that I would prefer as well in the backend so I'm going to change this to true and assuming I've got everything done we should now see yes I've got my types over here there's just one last job I need to do and that is to go back to my custom post type and let me just go down and make sure that those two are connected together and that's it I have now got my products let's go and see in fact let's go to the front end of the site and take a look that everything is showing here it is should you find that you do have a problem which is I think fairly rare with this plugin just know that what you want to do is to go over to your settings to permalinks and just save those again just to make sure that everything in the database has been updated I think the plug-in does that on its own but that's just one thing to check first if things aren't showing so I think that is this video done I do hope it's been of some use to someone if you did like it then as always then please give me a thumbs up because it's really encouraging and if you like these kind of videos and particularly if you're somebody uses beaver builder then please consider subscribing to the channel hope to catch you on another video soon I hope you have a great day thank you for listening goodbye
Info
Channel: David Waumsley
Views: 60,303
Rating: undefined out of 5
Keywords: custom post types, wordpress custom post types, wordpress custom post type, custom post type ui, custom post type, how to, wordpress custom post types and taxonomies, wordpress custom post type ui, david waumsley, dwvideos
Id: XBmjW2aqBFk
Channel Id: undefined
Length: 17min 53sec (1073 seconds)
Published: Mon Jul 16 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.