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.
Solution: Create an events post type - WordPress Tutorial
From the course: WordPress: Custom Post Types and Taxonomies
Solution: Create an events post type
(upbeat music) - [Narrator] Now that you've completed the challenge of creating an events type, I'm going to show you how I would solve the problem. So the first thing we'll do is copy our function that defines our business type. We're going to use this as a boilerplate for the events type. We'll copy the function in its entirety, and then we'll paste it below. We'll also change the function name to lil_register_event_type. Next, we'll change the labels. The first thing we'll do is delete all of the featured image labels here, and we'll just use the standard labels for that. Next, we'll change name to Events. We'll change singular_name to Event. We'll change archives to Events Calendar. And we'll change add_new and add_new_item to Add New Event. Moving down to our argument array, we're going to change the value of has_archive to events. We're going to change the menu_icon to dashicons-calendar. And then finally we will change register_post_type from business to event. The last thing…
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)
-
-
-
-
-