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.
Creating a single custom post template - WordPress Tutorial
From the course: WordPress: Custom Post Types and Taxonomies
Creating a single custom post template
- [Instructor] With our child theme created it's time to add our custom templates. We're going to start by building a single-business.php template to display individual businesses in our directory. And because everything is based off of twentynineteen, we're going to use that theme for guidance. Let's start within our twentynineteen-child-theme directory, by creating a new file called single-business.php. Here we're going to copy the single.php template from twentynineteen in its entirety. So inside the twentynineteen directory we're going to open up single.php, copy that, and then paste it into our single-business.php directory. We'll go ahead and save that, and then if we scroll to line 24 here, we'll see that the crux of the matter is a template part called template-parts/content/content, single. This is going to control all of the content for our template. So we want to recreate this directory in our child theme, and then make a file called content-single-business. Let's go ahead…
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)
The WordPress template hierarchy4m 9s
-
(Locked)
Setting up your child theme5m 47s
-
(Locked)
Creating a single custom post template3m 14s
-
(Locked)
Modifying the single template header4m 1s
-
(Locked)
Creating a custom post archive template3m 56s
-
(Locked)
Adding a custom taxonomy to a template4m 1s
-
(Locked)
Creating a custom taxonomy template2m 35s
-
(Locked)
-
-
-