Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Populating content into the custom post types

From: Create an Online Portfolio with WordPress

Video: Populating content into the custom post types

So far in the course we've created three new custom post types with associated custom taxonomies. Now it's time to populate these post types and taxonomies with some actual real content so that we have something to work with once we start working on the front end of the site. In this movie, I will show you how to populate some photos and recipes and I will also show you how to import content that's been pre-built by us, if you have access to the full set of exercise files. If you don't have access to the exercise files, it doesn't really matter all that much.

Populating content into the custom post types

So far in the course we've created three new custom post types with associated custom taxonomies. Now it's time to populate these post types and taxonomies with some actual real content so that we have something to work with once we start working on the front end of the site. In this movie, I will show you how to populate some photos and recipes and I will also show you how to import content that's been pre-built by us, if you have access to the full set of exercise files. If you don't have access to the exercise files, it doesn't really matter all that much.

All you really need here is some text content and some images that we can put in, so we have something to work with. So let's start off with the recipe. I will go to Recipes and click Add new recipe and then I will go to my assets, because I already have some recipes pre-built here. So I go under Assets > text and here we have a bunch of different text. I will pick one of them, artichoke_recipe, and I will copy the title, paste it into the title, and then I will copy the rest of the text.

Because I copied this out of Microsoft Word, I need to paste it in in a way that it doesn't bring with it all this extra styling content from Microsoft Word. And there's a tool for that inside WordPress. If you look at your toolbar here, you should see either one line of buttons or two lines of buttons. If you only see one, you can click on this button at the end here that says Show/Hide Kitchen Sink and then it will hide or show the bottom buttons. You need these second row buttons here to do this. On here, you have this button called Paste as Plain Text and if you click it, it opens a new window in which you can paste in your plain text, and then click Insert and it will be inserted without any style content.

Now we need to do some very quick editing of this text, just take out the extra spaces. I will change the ingredients to H2, so Heading 2, I will change each of the ingredients to a list item. So I'll just use a regular bullet list and then again some more plain text editing. I will change that to H2 too and then I will change each of the steps to an actual numbered list. Then I have to take out the numbers. And this kind of stuff seems tedious and unnecessary, but the reality is when you do it, you end up with a far more readable text.

If you think ahead about what you're doing and you actually make things more readable, for instance by creating real numbered lists, rather than just writing out the numbers, it will become easier for people to read it later. It will also become easier for search engines to understand what you're trying to do. So here you see we have a sub-item. So if I click on these Indent button, we'll get a sub-tem. It says A. The basic text editing tool in WordPress really provides you with all the same kind of text editing tools that you would expect from a full text editor; the only difference is it will happen inside WordPress itself.

So now we have a complete text, the next thing we need to do is fill out all these taxonomies. So we will start with Meal type. Steamed Artichoke sounds to me like an appetizer. I will click on Add new meal type and add Appetizer and click Add new meal type. So now we have the Appetizer meal type. Level of difficulty? This seems pretty easy to me, so I will say Easy and add that as a difficulty level.

Under Ingredients, we'll simply type out all the ingredients. Artichokes, garlic (cloves). And you see how I add commas after each of them. That means they're stacked as individual ingredients. You can also click Add for each individual one, but it takes more time. The comma approach is much easier. Once I have added all the ingredients, I can go to Preparation time and I am guessing this is going to take about 15 minutes and it will probably serve about 4 people.

Finally, I want to add an image, so I will go to the very beginning of the post and click the Add an Image button and then upload an image from my assets. So I will go to Exercise Files > Assets and photos and here I find some images of artichokes. So I will pick one that looks about right, upload it, and then I will give the image the same title and same alternate text as the title of the post itself or the title of the recipe and it's always very important to add the alternate text.

Even though it doesn't have a star next to it, it should have a star next to it. Now that the image is uploaded and has both the title and an alternate text, I am going to float it to the right, put it in as the medium size, and click Insert into Post. So now you see the image appears along with the rest of the text and I am ready to publish. So I will click Publish and then we can go and click View recipe. We can see now we have our complete post with an image.

I am going to do one last thing. I am going to put a little split in here. So at the end of the first paragraph, I will use this button here that's called Insert More Tag. All this does is it will add lines, so that if you are on an index page you only see what's above the line and not all the text. It just makes it easier to read the index pages. We'll update it again and we're done. The next step is to create a photo. The idea with the photos post type is to create a place where you only showcase photos of different items and you can also show multiple different photos of the same type of item.

So I will create a new photo here and I will call it artichokes and then I'll just add some photos. I will add this photo, just a big bowl of artichokes, and I will just call it that artichokes, set the Alternate Text as the same thing, and I will set this to Full Size, Center, and Insert into Post. Then I will add the Insert More Tag so that it breaks and underneath. I want to add a third image, only this time I will add it from my existing library because I already uploaded this photo to another post.

So instead of going and uploading it again, I am going to go to my Media Library here and here I'll see a list of all the images that are in the system and here we have that Steamed Artichokes with Creamy Garlic Aioli Sauce image. So I will click on Show and then Center, Full Size, Insert into Post. Now I see that the last image landed in the wrong place. So rather than doing a cut and paste from inside the Design view here, I am going to go to my HTML view, and cut and paste it from here. That way I know that I carry with me all the information I need.

So I'll go and look at the code and I should copy it from the beginning A tag till the end A tag. So if I simply cut that out and paste it into bottom. Go back to Visual. You'lll see we now have the right image at the top and then the two other images at the bottom. Finally, I need to add it as Meal type, and since this is the appetizer, I can check it as an Appetizer too, and then the Ingredient is Artichoke. Now, because we've already added artichokes as a tag or as an ingredient, when I start typing it, WordPress will suggest matching types, because you don't want to add tons of different versions of the same word.

So instead of adding a new one, I am going to pick the old one and click Add. And then finally, we're talking about photographic techniques, so I will call this one Lightbox and add the technique. Now, I can publish this post and again I can click View photo, and here you will see we have all the three photos of the artichoke displayed under the photo post type. So far we've created one recipe and one photo, but you need a lot more information. Therefore, I have compiled content for your site.

So if you have access to your exercise files, instead of doing all this work, you can just import existing content instead. So if you collapsed everything and you go down on the menu bar, you will see it says Tools. If you open Tools, there is a function called Import. Click on Import and you get to the Import screen, and here we have a list of different platforms from which we can import content. Now, we want to import from WordPress, so I will select WordPress, but because we've never done this before, I have to install the WordPress Content Importer.

It automatically opens the plugin installation window and I simply install it. And now WordPress will let me import. So I will click Activate Plugin & Run Importer and now I can start importing content. However, because my import file also contains some images, we're going to move the images into our site before we do the import so that they're already there. So I'll go down to my Assets again, click in Assets, and you will see there's a folder called uploads and if you go into your WordPress installation and you go into wp-content, you'll see there's a matching folder called uploads here too.

So what I am going to do is merge these two folders. I will simply drag it over from my Assets and copy it in and when we open it now you will see that we have a new folder with lots of extra images. These images will be called by the file we're going to import, which you can see here it's called culinaryartistryContent. So now we can go back to WordPress, choose the file culinaryartistryContent, and click Upload file and import.

We need to assign an author to it, so I'll just assign myself, and you have to also check this Download and import file attachments so that WordPress knows to look for those images we just dumped into the folder. When you click Submit, WordPress will run through all the contents and import all the content and put it into right places. When it's done, it will simply give you a message like this All done. Have fun! And if you're now going to post recipes or photos, you will see we have more content than we did before, and we can go and view any of these items and if everything worked, you should see not only the text but also images.

Populating a custom post type is no different from creating a regular post or page. All you do is fill out the information in the Admin Panel and your custom post is created for the world to see.

Show transcript

This video is part of

Image for Create an Online Portfolio with WordPress
Create an Online Portfolio with WordPress

40 video lessons · 28590 viewers

Morten Rand-Hendriksen
Author

 
Expand all | Collapse all
  1. 6m 28s
    1. Welcome
      58s
    2. Using the exercise files
      3m 54s
    3. Using the code snippets file
      1m 36s
  2. 8m 31s
    1. What is an online portfolio?
      2m 43s
    2. Tour of the finished project
      3m 15s
    3. Setting up a WordPress development environment
      2m 33s
  3. 16m 10s
    1. Creating site architecture
      5m 1s
    2. Creating a child theme
      6m 7s
    3. Creating an external file to manage functions separately from the theme
      5m 2s
  4. 25m 26s
    1. What is a custom post type?
      2m 14s
    2. Setting up a custom post type
      6m 39s
    3. Adding advanced variables to the custom post type
      3m 35s
    4. Advanced custom post type functionalities
      4m 29s
    5. Changing the menu position of the custom post type
      3m 19s
    6. Adding a custom post type icon
      5m 10s
  5. 22m 8s
    1. What are custom taxonomies?
      3m 34s
    2. Setting up a basic custom taxonomy
      2m 52s
    3. Hooking a custom taxonomy to a post type
      3m 13s
    4. Adding advanced variables to a custom taxonomy
      3m 9s
    5. Using hierarchical and nonhierarchical custom taxonomies
      5m 54s
    6. Using custom taxonomies in admin
      3m 26s
  6. 25m 40s
    1. Populating content into the custom post types
      10m 54s
    2. Uploading videos to YouTube
      2m 22s
    3. Embedding YouTube videos in a custom post type
      4m 23s
    4. Uploading videos to WordPress
      8m 1s
  7. 39m 47s
    1. Creating custom post type templates
      6m 50s
    2. Adding taxonomy info to the custom post type template
      9m 13s
    3. Creating conditional custom taxonomy links
      4m 46s
    4. Handling multiple post type templates: Individual templates
      6m 25s
    5. Handling multiple post type templates: Consolidating everything in one file
      6m 21s
    6. Handling multiple post type templates: Making custom post types the default
      6m 12s
  8. 15m 23s
    1. Creating an index page for a custom post type
      8m 10s
    2. Creating a custom taxonomy index page
      7m 13s
  9. 12m 3s
    1. Creating a custom footer sidebar template
      6m 58s
    2. Displaying a list of links to the latest custom post type posts
      5m 5s
  10. 14m 58s
    1. Creating static pages for the front and the blog
      4m 54s
    2. Populating the menu with new index pages
      4m 52s
    3. Creating a contact page with a contact form
      5m 12s
  11. 5m 55s
    1. Including the abstraction layer in other stock themes
      5m 55s
  12. 1m 22s
    1. Next steps
      1m 22s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Create an Online Portfolio with WordPress.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.