 Hi everyone, good morning. Some of you who might have been in this stream yesterday might have already seen my face around. My name is Jory, I do hail from Perth. Please don't hold it against me. Hopefully we'll see some of you guys there next year because we are running our first word camp next year. And I just want to get an idea before we start on who has used custom postcards before. Just put your hand up if you've used custom postcards before. Who's used custom fields before like ACF or pods or anything like that. Who has no idea what custom postcards or custom fields are. Who hasn't put the hand up yet. Alright cool. I just wanted to make sure you guys are all capable of putting your hand up. So I want you to do one more thing for me. Can I just get everyone to stand up? That's squeak, right? That's amazing. So I did something when I did my first word camp a little while ago in March in Cebu and you guys already have a head start because you already know what a Mexican wave is and I know that you can all put your hands in the air and you can all stand up. So sit back down again and we're going to do a Mexican wave and Ricky's going to film it for me because I want to make sure that you guys are all awake because I saw a lot of these faces at the after party yesterday. So we're going to start from this side. Alright so on the count of three we're going to start a Mexican wave from this side. Are you ready? Are we filming Ricky? Okay ready? One, two, three, go. I find this to be that at every word camp I ever speak out. So this is the second one. Watch this space in ten years time I'll have a whole collection of them. I'll put the video up on Twitter. Thanks so much for filming that Ricky. So I am going to be talking about custom post-hats and custom fields today and I just wanted to clarify right up front what all of these things that I am talking about mean and then there were quite a few people that said they hadn't used custom post-hats or custom fields before. So I'm going to explain what a few of these three-letter acronyms actually mean. So CPT is custom post-hats, CF is custom field, ACF is actually a plugin called Advanced Custom Fields and it's a really common way of actually implementing custom fields coming in guys and POD is not actually an acronym at all it's just the name of another plugin that I'm going to be talking about a little bit. So why do we care about custom post-hats and custom fields? Now I apologise if this is a little bit too basic for some of the developers in the room but I think it's really important because there are a lot of people who are just starting out in their career in WordPress or they're using it for their own business and they don't actually understand why WordPress is so flexible and so valuable and the reason why I think that WordPress is so amazing is because you can use custom post-hats and custom fields to really extend the existing WordPress architecture and you can build some really funky stuff with it. It gives you a lot more flexibility than just using a plugin that you get off of the repository if you can create your own custom post-hats and this is actually where I first came across this concept way back when I first started wasn't that long ago but when I first started using WordPress one of the very first websites that I ever built was for my community group and we wanted to make a business directory and we were like cool let's have a business directory we'll support local business seems like a great idea at the time by the way don't volunteer with your local community group it is very unrewarding because nobody ever says thank you but we decided we were going to do this business directory and so I spent hours looking for a plugin that would do exactly what we wanted and I still didn't find one and I think we ended up buying one and then tweaking it fortunately I'm married to a PHP developer so that made it a little bit easier but I wish that back then I had known about custom post-hats and custom fields because it would have been a much better way of doing it it also makes it a lot easier for those of you who are building websites for other people and they're sort of fairly new to WordPress it does make content management a lot easier for say testimonials if you've just got something called testimonials right so what is the difference between a post-hats and a custom field in a nutshell there's already a bunch of post-hats in WordPress and that's actually how WordPress works pretty much everything that already exists inside WordPress is a custom post-type so you've got pages you've got posts you've got attachments you've got revisions you've got navigation menus they're all stored in the WordPress database as post-hats and then you can create your own ones as well and then we have custom fields so the difference between a post-hats and a field is that a field tells you information about a post or about a post type and it can vary depending on what post type you're talking about so you have different fields on posts versus products for example so products is another example of a post type so examples of fields that you've got your titles your authors your SKUs for your products your price all of that kind of stuff that's your fields right these fit into all of this because this one was one that caught me out when I first started in WordPress and the answer is basically there are two taxonomies that come as a default with WordPress and you probably already familiar with categories and tags but you can create your own custom taxonomies and they're really useful when you need to be able to group posts based on a particular field right so imagine that you've got a field that you can use to display a group of stuff that's essentially what a taxonomy is so if you're trying apologies that's so big but Ricky doesn't have my fonts installed so just pretend that's like handwritten okay so basically if you want to be able to group stuff so you want say an archive page then you would use a taxonomy instead of just a standard custom field and I'll explain using a couple of examples how that might be done so who's used we commerce before right only any of those people did you say that you hadn't used custom post types before because that's actually wrong you have if you've used we commerce you've used custom post types because we commerce itself actually creates products orders coupons and refunds in your database they're all post types and they also create a bunch of custom fields like price and SKU let's say I wanted to write a blog and I wanted to have a bunch of book reviews so rather than just using my standard posts I might create a custom post type of book reviews and so I was like cool I'm gonna write a book review about Harry Potter because it's a classic right who doesn't like Harry Potter and then I was like what would be really cool is if I could actually review series as well so I need a way of grouping all of the books in a series so this comes back to do I use a custom field or a taxonomy and in this case I use a taxonomy for that so you can see in the bottom right that I've actually added a couple of custom taxonomies there for genres and series and there's an example of where I've created a custom taxonomy and I'll explain how I did that in a second this is another example so the directory that I mentioned it would have been a lot easier for me back then if I'd known about custom post acts because then I could have just created one that had the exact things that I needed in there so let's say I need to display and a bunch of information about charities that I really like supporting so everyone know what the ally project is yeah if you don't look it up they do awesome stuff I'm really passionate about accessibility if anyone wants to have a chat about it later she called Australia which I mentioned earlier is a cause that's very close to my heart and I've been involved with them for several years so let's say that hypothetically I wanted to have some custom fields in there so you can see down the bottom here the custom fields that I've added in this little meta box of where they're operating whether or not they've got charitable status who to contact if you want to volunteer and be a sponsor in Brisbane but she called Australia so if anyone's interested there also other examples that you might use a custom post type for testimonials is a really common one team members you want to add a photo maybe you want their position or something like that kittens that you want to rescue because kittens are definitely better than doggos sorry Alex but look at that face it's so cute so how do I make a custom post type there are a bunch of ways and there's no one right way it really depends on what you're looking to achieve so the first way is PHP code looks very simple right yes who's made a custom post type using PHP before who thinks is that simple yeah alright so this is probably more realistic but this is actually more realistic it's a lot of code and we actually did this when we first started making custom post types and my advice would be refer back to the codex a lot and while when we first started doing it we were using the child theme and we were just putting it into the functions dot PHP file since then my advice would probably you user must use plug-in instead because that way if like us you decide that you're going to switch from Genesis to a different theme that's a little bit more lightweight sorry Ricky if you're here so if you decide that you're going to switch themes later then you don't have to drag all of that stuff out of your child thing and put it into a new one if it's in a must plug in it is also according to WordPress the best practice and that actually was the reason why we stopped doing our custom post types using PHP was because when Gutenberg came out we had to go fix everything because it wasn't actually the way that we'd done it we had to make a few tweaks and stuff to make it compatible with Gutenberg now well about a year or two ago we started doing it using custom post type UI this is a really neat little plug-in that's on the repository it's been around since version 3 of WordPress it's got over 700,000 installs works really well with page builders for those of you that are like Elementor and Beaver Builder fans which are clearly the only two page builders you ever need to worry about and it but it does only allow you use the basic fields that are built into WordPress already so this is a really easy way of creating a custom post type and one of the perks of doing it this way is that when there are changes to WordPress it's the developer of CP or the developers of CPT UI who are responsible for making sure that it remains compatible and secure not yours so we've actually we started using this a few years back and this is an example of what it looks like but one of the biggest disadvantages to using CPT UI is that the page is very very long and if you're new to this and it's the first time you've created one you can see how that might be a little bit overwhelming right there's a lot of tick boxes and things there and keep in mind this still doesn't allow you to create custom fields it only allows you to create a custom post type so now I introduce pods and pods is another plug-in that's on the repository and I think we're actually doing a whole hallway track straight after this for pods if anyone's interested in it and I've just recently started using this and I think for simple custom post types it's actually a really good alternative and so what it does is it allows you to do custom post types and custom fields it's got a lot less install some CPT UI it's kind of the new kid on the block but their community is really active they have their own their own Slack channel and they it's completely open source so there is no pro version so that's a for some people that might be an advantage for a lot of people that's a disadvantage because it means that you also don't have support this is what it looks like I think the UI is much nicer for beginners than CPT UI it's a lot less scrolling involved so that's the longest page that I could find in CPT in our in pods so if you are absolutely brand new to custom post types and you want to give it a well my suggestion would be start off with pods and then graduate to something a little bit more complicated someone actually introduced me to this one on Friday I'm not going to spend any time on it but if you are a developer and you want to like level up check it out it seems pretty cool one of the disadvantages I guess that I saw with it is that the interface does require you to go outside of the WordPress dashboard so that you and I think they've got like a generator or something so check that out if you haven't seen it before it looks pretty neat I'm gonna have a play with it tomorrow and that's what their generator looks like and then we get to advanced custom fields did anyone attend Alex's talk yesterday about using advanced custom fields blocks it was really really interesting and that's also what I'm going to be doing tomorrow but advanced custom fields is a fantastic plugin it was created by Elliot who I don't think is in the room at the moment because he did let me know that he was going to have to disappear I promised him that I wouldn't bag it out so everyone tell him I said super nice things about it alright but it can be used with any post up including things like we commerce posts so products and reviews and stuff like that it can be used with existing like with posts just your regular posts post types that you create using CPT UI or using pods so that's really useful it has been around for a really long time and it has a pro version as well which means it supports really important to you that's something that I think is it's really helpful that it also is has much better integration I think we've compared to something like pods with Gutenberg and one of the perks I think of using ACF is that it allows you to add for example hang on we'll just this is what the UI looks like if you want to add a custom field and it allows you to add stuff on the sidebar there which is really nice and it's a lot cleaner if you're using the Gutenberg let's say you want to add a custom field to a post if you've got a massive long blog post on there you don't want to have to scroll all the way to the bottom to add your custom field in a meta box unfortunately with pods that's the only way to do it at the moment so I just want to duck back super quickly to the last point on here about ACF using the existing tables so I mentioned that all of the post types are stored in the post table right well all of the custom fields and all of the fields in general are stored in what's called the post meta table and usually that's not a problem that's just how WordPress works right but it can be important if you've got a ton of information right and there are very small number of times where it can be a problem right and I came from the weirdest introduction into WordPress ever because I actually came from an SQL background so of all of the languages that make up the WordPress stack a lot of people don't even consider SQL to be a coding language it's a very odd place to start but to me it's always been confusing that that's the way that the WordPress databases work and when you are doing a lot of queries and you've got a lot of custom fields and a lot of data it can make a big difference not having those things in a column rather than having them in the meta fields table so in pods one of the neat things that I discovered is that you can create advanced content types and you can create custom post types using their own custom database tables now while this is really cool and it's pretty easy to do you just activate it from the components menu for those of you that want to give it a well please don't do it unless you need to because it also means that a lot of the things that make WordPress WordPress and allow you to use other plugins to do cool stuff you're not going to be able to achieve that if it's all in a different table and it's looking for something that's not there so when you would use advanced content types would be things like data separation is important or if you're doing really big queries then you might actually want to consider that and the other time is if you're going to be resetting your data a lot because if you're resetting your data a lot especially if you have a lot of fields and a lot of data that's basically going to mean doing massive queries on your your post meta database so that's where you might want to look into that if you are interested in looking at what custom fields and custom post types can do I really really strongly recommend when it comes out watching Alex's talk because it was one of the best ones that I've seen all weekend so good work for that and I'm really looking forward to actually trying out ACF blocks and you can actually also do it using that meta box.io one that someone introduced me to on Friday I can't remember who it was thank you I'm really excited about playing with it and that's pretty much it for me I think we're running a little bit behind so I don't know if we've got time for questions or not yeah if anyone does want to ask me a question I will be around in the break and I'll be around for the rest of today if you want to like ask me questions on Twitter I'm at Joe Minio and basically everything and if you want to find out about she codes go to shecodes.com.au there's lots of custom post types on there and if you're interested in learning more about custom post types I'm also an advisor with the Australian Small Business Advisory Service so have a chat to me about that program if that's something you'd like to know more about thank you for listening to me Ramble