From the course: WordPress: Custom Post Types and Taxonomies
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Customizing your post type settings - WordPress Tutorial
From the course: WordPress: Custom Post Types and Taxonomies
Customizing your post type settings
- [Instructor] With our labels set, let's turn our attention to the settings, which we're going to pass through the argument array. The codex makes it clear which of these arguments are true by default, and which are not, making it easier for us to know what we need to pass through code. There are a few things we do want to set, though, such as have archives, the rewrite rule, we want to set the menu icon, and we want to make sure to add those supports. If we look at the current state of our Add New Business screen, you'll see that while we have the title and editor, we don't have the featured image, and the block editor is not enabled, but we'll touch on that later. So let's go back to our code and in the arguments array, we'll start adding some key value pairs. The first is has_archive. We're going to set this explicitly to businesses. Remember our slug is business, but we want this to represent the fact that there are multiple businesses. Next is rewrite. We want to make sure that…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Creating your plugin3m 16s
-
(Locked)
Building a basic custom post type5m 37s
-
(Locked)
Customizing your post type labels4m 51s
-
(Locked)
Customizing your post type settings3m 13s
-
(Locked)
Activating the REST API on your post type1m 54s
-
(Locked)
Creating a post with your post type1m 56s
-
(Locked)
Challenge: Create an events post type1m
-
(Locked)
Solution: Create an events post type2m 21s
-
(Locked)
Extending post types with custom fields2m 14s
-
(Locked)
-
-
-
-
-