New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Start learning with our library of video tutorials taught by experts. Get started

Create an Online Portfolio with WordPress
Illustration by

Adding advanced variables to a custom taxonomy


From:

Create an Online Portfolio with WordPress

with Morten Rand-Hendriksen

Video: Adding advanced variables to a custom taxonomy

Just like with the custom post types, when you make a basic custom taxonomy WordPress defaults all the names to, well, the default, so either category or tag. You can see it here on the side. You'll see it says Meal type at the top here over the header, but on the bottom it says Add New Category. And that's kind of confusing. It should really say, Add New Meal type, right? Fortunately, just like with the custom post types, we can add an array of custom labels to our custom taxonomy, so it makes more sense. This is pretty much done in the exact same way we did for the Custom Post Type, and again I put the code into the code snippet, so you can just copy it out and paste it in.
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

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
Create an Online Portfolio with WordPress
3h 13m Advanced Sep 23, 2011

Viewers: in countries Watching now:

Learn how to build an advanced portfolio site that showcases various types of content using the free open-source application WordPress. Author Morten Rand-Hendriksen demonstrates creating custom post types, differentiating and classifying content with custom taxonomies, and working with custom post templates. The course also shows how to embed YouTube videos, build index pages, display the latest posts from different custom post types, and hook custom post types into separate themes. Exercise files accompany with the course.

Topics include:
  • Exploring online portfolios
  • Creating the site architecture
  • Incorporating advanced custom post type functionalities
  • Hooking a custom taxonomy to a post type
  • Understanding how hierarchy relates to taxonomies
  • Populating content into custom post types
  • Handling multiple post type templates
  • Displaying a list of links to the latest custom post type posts
  • Building static pages for the front and the blog
  • Creating a contact page with a contact form
Subjects:
Design Web CMS Web Design Projects
Software:
WordPress
Author:
Morten Rand-Hendriksen

Adding advanced variables to a custom taxonomy

Just like with the custom post types, when you make a basic custom taxonomy WordPress defaults all the names to, well, the default, so either category or tag. You can see it here on the side. You'll see it says Meal type at the top here over the header, but on the bottom it says Add New Category. And that's kind of confusing. It should really say, Add New Meal type, right? Fortunately, just like with the custom post types, we can add an array of custom labels to our custom taxonomy, so it makes more sense. This is pretty much done in the exact same way we did for the Custom Post Type, and again I put the code into the code snippet, so you can just copy it out and paste it in.

So let's go to code-snippets file and you'll see under 04.04, we have this new array, m$eal_labels = array. We'll just copy the whole thing, go into our posttypes.php file, find the Meal type function and attach the array directly over register_taxomony. Looking at this, you'll see it's very similar to what we did for the custom post type. In the array, we have the name of the post type, so Meal type and it's a bit funny because Meal type is kind of the same plural and singular, but we still have to add the singular_name as well.

We also have search_items, so you can search in meal type. all_items, All meal types, and then we've this function for most_used_items, parent_items, and parent_item_colon. These you can turn on and off if you want to and you can see what they do. They are quite interesting, but they don't always apply. And then we of course have edit, update, add_new, add new, and menu_name. All these things are fairly obvious what they do. We've created the label, so now we need to remove our label down here in our similar_name just like we did for the Post types.

So I'll take out the similar_name line and under label, I'll change it to labels. Then I'll take Meal type out and replace it with $meal_labels, which is the name of the array just up here and when I save it and go back to my Admin Panel, you'll see that it now says Add new meal type down here, instead of just meal type. And you'll also see, when we go to Meal type up here, you'll see that it now says Add new meal type up here.

It says Add new meal type on the button, and it even says Search in meal type rather Search bar in the side here. This is again very simple stuff that doesn't seem all that important, but trust me, when people start working with this and they didn't build it, if you don't provide this information, they will get very confused really fast. And it's one of those small things, just like when you're building a house and you put in floorboards that makes that final touch of professionalism, and it makes it easier to use in general. So always remember to put in all the way of labels using this exact code.

And like before, if you want to get the exact function I'm using and you don't want to just copy and paste and hope that you're right, you can scroll down here to the Full function and simply copy the whole thing, all the way from Add custom taxonomies down to the end curly bracket, and just paste that into your posttypes.php file and you'll be good to go.

There are currently no FAQs about Create an Online Portfolio with WordPress.

 
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.
Upgrade now


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.

join now Upgrade now

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

Notes cannot be added for locked videos.

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.