From the course: WordPress: Custom Post Types and Taxonomies

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Creating a single custom post template

Creating a single custom post template - WordPress Tutorial

From the course: WordPress: Custom Post Types and Taxonomies

Start my 1-month free trial

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…

Contents