344 – Customizing WordPress to Fit Your Needs
Is there a plugin for that?
With more than 50,000 plugins in the WordPress repository, it’s hard to find the perfect one. Each week, I will highlight an interesting plugin form the repository.
For more great plugins, download my 50 Most Useful Plugins eBook.
Worth the Read is a very unobtrusive and light-weight reading progress bar indicator showing the user how far scrolled through the current post or page they are.
Customizing WordPress to Fit Your Needs
There really isn’t a hard/fast rule here. It comes down to practicality, personal preference and how your theme is built. There are some good guidelines though; if it seems like some of these apply to you, a custom post type might be in order:
- If you publish at least two very different types of content. For example, personal blog entries and recipes.
- If it would be better to visually and structurally distinguish a specific type of content. For example: personal blog and your illustration portfolio.
- If a type of content doesn’t fit in a chronological order. For example, a company blog and company style guides.
- If a content type could easily be separated out into a different website and still remain coherent. For example, a personal blog and sold products.
- If using categories and tags would lead to over-complicated taxonomies. For example, a personal blog and movie reviews.
Generate all the necessary code with GenerateWP
Check out these webinar replays for video steps on how to add this code to your website:
Thank you to those who use my affiliate links. As you know I make a small commission when someone uses my link and I want to say thank you to the following people. For all my recommended resources, go to my Resources Page
Join the newsletter
Subscribe to get regular WordPress content delivered right to your inbox.
Full TranscriptBusiness Transcription is provided by GMR Transcription.
In today's episode we are going to talk about how to custom size the Wordpress dashboard to fit your needs by using custom post types right here on Your Website Engineer podcast episode No. 344.
Hello, everybody, welcome back to another episode of Your Website Engineer podcast. My name is Dustin Hartzler, and I'm excited to be with you this week, because this week, and this month we'll be talking about custom things that we can do with WordPress, and more advanced features that we can do to get more out of our WordPress site.
And today we're going to drive into custom post types, but first I've got two announcements, and one plugin to share with you. The first announcement is WooCommerce 3.1 has landed. It's just a minor release for WooCommerce, but it has a few brand new features. The first one is there's now csv import and export, and so in the past moving data between WooCommerce sites, from one site to another, required a premium importer plugin, or had to mess with the WordPress xml files and now with 3.1 it's built right into WooCommerce core. Another thing that's awesome that's built into the core now is the WooCommerce helper. This used to be a, a third, third extension you'd have to install that could manage all your license and subscription keys, now that's built right into 3.1 as well.
You connect your account and then you can automatically download your plugins and anything else that you have purchased from the WordPress, or from the WooCommerce store, you can download those and activate them and add your license, everything is just done through this, it's really nice. There are a few other things that have been added like the new terms and conditions check box is now built into WooCommerce core. It's, there's [inaudible] [11:32:31] beds that were non-functional in product descriptions and now they're supported that you can set stock statuses for variations in bulk. There are a lot of little minor improvements and so if you are running a WooCommerce store definitely check out WooCommerce 3.1. Do a backup of your site and get this thing updated to the newest version. You'll be glad you did. There are a lot of cool features that are just built right now.
The other announcement that I want to share with you today is that Automatic is now renewing their efforts to the, the underscore's framework, and this is a starter theme generator. This is a code base, I guess, that a lot of theme developers will start with. It's got some, you know, really good standards in the way of setting up a theme and getting themes set up and going, and there hadn't been any type of activity in GitHub for the underscore theme for the last six months or so, and now they're starting to work on it again.
This isn't that they were discontinued. There were just other more important projects to work on, but now since we're working on Gutenberg, which is the plugin that I've talked about the last couple of shows, the new content block editor for WordPress it's going to come into core very soon. Now that they're working on that, they're trying to get – make sure that the underscore theme is all ready for that, and to make sure that themes are working really well, so that's just another piece of announcement coming out of Automatic.
All right, moving onto the – is there a plugin for that section. This one is kind of cool, and I've been noticing this on several different websites as I browse around, Smart Passive Income is one, there's, there's a new other sites that you just notice this, but this is called: Worth the Read. And this is a plugin, it's – a thousand active installs, but it is a very unobtrusive lightweight reading process indicator that shows the user how far they've scrolled through the current post or page they are on. So this is a little line that goes across the top of the webpage and it – the farther down you scroll the longer the bar gets across the top, so it's kind of a status bar. It kind of just is a subtle little indicator of how much longer there's in a post.
This is great for, for websites that have really long posts or pages and as you kind of scroll through those it goes right across the top. This might be something that I implement on my website. I've got a nice area where I could – where I would add this, and so we'll see how that works and see if I can – if, if, if it actually looks good on yourwebsiteengineer.com. But this is a cool plugin I thought would be interesting to share with you, it's called: Worth the Read, and it is done by Well Done Marketing, and you can find it on the show note – in the show notes for episode No. 344, or just search the repository for Worth the Read.
Okay, today we're going to dive in and talk about custom post types. Custom post types are probably one of my favorite things of WordPress, and they're really hard to talk about on a podcast and they're – but they're really useful and you can do some really cool things with them, and I've, I've created some custom posts for some kind of unique ideas, and unique things on client sites in the past. But let's go ahead and we'll talk about what they are, and then a little bit about how to set them up. It's kind of a pain to talk through all of the pieces, so I'll talk about some of them, and then I'll talk about a site where we can just go and we can just generate all the code that we need and we can drop that into our WordPress theme, or functions.php or our custom functionality plugin, whichever we're, we're looking at, and we'll talk about that in a minute as well.
So what are custom post types? Custom post types are basically a feature inside of WordPress that helps to transform WordPress from just a blogging platform to a fully pledged content management system. Post types cannot be created and managed from the dashboard, so you had to add a little bit of code, but all the code can be generated, like I said, and it makes it – it makes it very – more of a, let's – it just makes the experience inside of WordPress just that much better. So let's talk about – a little bit about what a custom post type is. A custom post type is just an additional post type that's not built into WordPress. Right now within Word Press there are five different built-in post types. There are posts, there's page, there's attachment, and that's all the images and media gets uploaded to, an attachment, there's two more, and one is revisions and nav menu items.
So revisions is the post type – or it's just like posts, but it contains all of the, the saved, auto saved information about a post when you're writing it, so there's a revision tab for that – or there is revision post site for that. And then the navigation menu items this is a, a special post type built specifically for those menus that you create inside your WordPress dashboard. But then you can create as many of these other custom post types, if you will, and – okay, let's, let's talk about why you may want to do this. Like what – when do you use a custom post type? And it may be difficult to figure out based on your client's site, or your needs, or on your website, but you just want to kind of think through, there's no real rule of stone here, or rule of thumb. It comes down to practicality or personal preference on you – in how your theme's built.
And here's some guidelines that may help you decide whether you need a custom post type or not. If you publish two very different types of contents, so maybe you have a blog or a podcast, or maybe you have a blog and you have recipes, or maybe you have – I don't know, there's, there's infinite number of solutions, or infinite number of combinations of things you could post. So if you've got two different distinct areas then maybe a custom post type is the way to go. If you want to better visually and structurally distinguish your specific content – so maybe your blog post will look different from a portfolio item then a custom post type is probably the way to go. Maybe if you're content doesn't fit in chronological order – so maybe you have a company blog and you want company style guides, like the style guides don't need to be in alphabetical order, so maybe that's a good reason to use a custom post type.
If a content type would be, would be easily to be separated into different website and still remain coherent – so maybe you had a personal blog and sold products that you've talked about the past, like that would be a good way for a custom post type. And then if you're using categories and tags – will lead to over complicated taxonomies maybe you have a personal blog and a movie review, but you don't have like comedy as blog post categories, but that would be perfect for a category or a genre of movies, then that would be a good reason for a custom post type as well. So what a custom post type is – it's basically like a post type – you know, in the, in the WordPress dashboard you go to, you know, under dashboard you go to post and then you have the ability to add a post – a brand post that's built into WordPress.
Well, what a custom post type is, is creating another little bucket just like that. So instead of saying post maybe you could say like on – I have one yourwebsiteengineer.com that's called webinars, and then I have specific areas or I have – it's set up exactly right for all the content that I need for a webinar, and so instead – I put the title and then I put a little description and then I've got some, I use some custom fields and post medafields at the bottom of that section specific content for like downloads to webinar past replays, and whatnot like that. And so – and then I think I – inside of that I also have a beginner and I have an advanced tag, so if people are looking for different styles of webinars I can categorize those.
I don't have podcasts – or my podcast page is not – I, I can't be categorizing those by beginner and advanced because those are not – those are blog categories and not custom post type categories, and so that's one way that you can use custom post types. I have another category that's a – it's, it's, it's more, more of a speaking field and so it is custom post type and I have places where I can at information about speaking events. So if I go to an event to speak at a Word camp, I like to have a downloadable pdf where people can get the information and the resources and, and whatnot, so I have an area where I can put in all the custom post type information so I can put in – here's my slide deck, here is the downloadable worksheet, here's the location where I spoke, and the time and date, and things like that, that can be all added to a custom post type.
Custom post types are really nice because you can change the labels, so instead of it saying post you can say like speaking, you can say webinars, you can say recipes. You may see this a lot in themes that are purchased like from themeforest.net, they always have custom post types built in. Sometimes you see a testimonials area, sometimes you see a recipe area, or portfolio area, or about the team area, those are all custom post types and they're just created by the theme developer to, to allow you to do certain things, or to add areas to your website very easily. I did one on a website that was about the team page and then all they had to do was fill in the, the name, they put their name at the very top in the post area, or the title area, and then they added a little description, and then I created a little box where they could be their email address in and then I hyperlinked it and I made it all visually layout exactly the way that I wanted it to. And that way a customer, or the client didn't have to go in and try to wrap a mail – an email address with the mail tags – which would have been really confusing for somebody that, you know, has zero html abilities. That's kind of post types in a nutshell.
Now, I can talk about all of the ways to set these things up and, and go through all of the code and the details, but that's not going to make a lot of sense, and I don't want to bore you all of these details of how, how to set this up when you can actually do this over on a website called generatewp.com, and there is a post type generator there, and what it does is it basically – you can set the options on what you want to do. How you want to set this thing up and then you hit update code and it will automatically add the code that you need and you can copy and paste that and you can put that into your website.
And so I'm looking over here at generatewp.com, and you can give it a, a name, you can tell it what the function name is, whether that custom post, post it's just going to be custom_post_type, you can say that it's Dustin's post types. You know you can give it a function name and you can say that – if you're using it that child theme you can add that, and you can add the text domain. But then you're, you're going to fill in more information. You're going to talk about the description. What is this custom post type? You're going to say what the, the singular name is, so like recipe or webinar, and then you can say the plural name so recipes, or, or webinars, and then you just fill in all this information. There are different tabs and there are different items, and you just go through here and then you update code and it's going to spit out this whole bunch of code, and it will – all you have to do is then add this to your site.
Now, where do you add this? This is a big question, and it's kind of a controversial topic, there are a couple different places where you can add this. The first one is if you're using a child theme you can put it right there in your functions.php file, and that will automatically add information, or it will add those sidebar areas right to your WordPress site. You save it. And then you do a refresh inside of WordPress and it's going to be there. There's – that new post type is going to be there. You can also put it in the functions.php file of a theme that you've purchased, but just, just to let you know in case that theme updates some day, there's a good chance that you would wipe out this information and then it's completely gone. All the content would still be there even if the menu item is not there, but it could be completely erased, quote unquote, if you update the theme and all of your code has disappeared.
Now, my favorite place to put this code is in a custom functionality plugin, and I'll put a link in the show notes to how to do this, but basically you create a small little plugin and then you can just copy and paste this in there, and then since it's in a plugin it will always stay with your site, even if you change themes, or you, you know – if you – I guess that's the main thing that would happen, if you would change themes or your theme would update then you don't have to rewrite all this code in – add all of this back in, so that's how you add it to your site.
Okay, once we've added this code into our child theme or this custom functionality plugin now we've got to display it on our site, and if we do nothing it's going to display exactly the same way as posts do, so if your post has a, a main area on the left and then a small sidebar on the right, then your custom post type will display in the exact say manner. It just will go and use the same template files. So WordPress will automatically use the single.php file, but if you want to make some more custom adjustments then you'll need to create a brand new – you can copy the single.php, and then you can name it single dash and then whatever your post type name is, .php, so in the webinar's case it would be single-webinar.php, and then WordPress knows to look at that, and then you can start making adjustments and customizations to that page it itself, and if those pages aren't defined – so if you don't have that custom page defined, then like I said, it's going to use the archive.php or the single.php, and if you don't have those pages then it will just default to index.php.
To recap, you – once you've added this code to your WordPress site you've added in a custom functionality plugin or it's in your child theme then you have to create these new template areas either single-your post type.php, or archive.php, or there's category-your post type.php, you create these new template files by, by duplicating the single.php or archive.php, and then you can start customizing those to your heart's content, you can really hone in exactly what those pages look like, especially if they're going to look different, maybe they'll have a different background, maybe they'll have different style, whatever that case may be you can do that all within WordPress and it just makes for a much more custom experience, especially if you're building a website for customs – it just gives you that ability to make WordPress really what you need instead of just, okay, I'm going to use the post area for everything.
So that's what I want to share with you this week. Next week I got more great WordPress information in another WordPress show, and so until then, take care, and we'll talk again soon. Bye-bye.