
You can display the contents of a custom post anywhere. Now, to display the post on the front end.
#Wordpress add media meta box code#
Here's the code that will go into functions.php. You can call it whatever you want, but it might be easiest to practice the first time around with the same names I used. I'm going to create a custom post called Your Post, with the id your_post. I'm starting off with a completely empty WordPress theme, just like in part one. I promise I'll make it as simple as possible.Īnything throughout this article prefixed with your_ is custom, and you can change the name. It's basically a simplified version of what Advanced Custom Fields does, but without any plugins.
#Wordpress add media meta box how to#
Have you ever wanted to add another upload field for images outside of the "Featured Image" thumbnail option? In this article, we'll also learn how to add an upload button and browse through the media gallery to insert an image. The gist of it is, have you ever wanted to add an extra field to a WordPress post? Maybe a date, or a URL, or an e-mail address? We're going to learn how to do that. There are a lot of WordPress-specific words going around already, and it's more confusing than I'd like. If not, you can still do this tutorial from scratch as long as you have a basic knowledge of WordPress. If you've been following along, you can just add this on to what you already have. This tutorial is independent of the previous installments. Basic knowledge of WordPress functions and custom post types.Basic knowledge of WordPress and how to create your own theme.

And it's going to be easy, you'll love it.

In part three, we're going to learn how to add basic custom fields to a post, save them in the database, and show them on the front end of the website, without a plugin.

In part two, we learned more advanced concepts like adding comments and images. In the first part of my WordPress tutorial series, we learned what WordPress is and how to create and use a basic theme.
