Category:Wordpress Tutorial

Add WordPress Meta box and Use Its Value on Front End Posts

What will We Get:

  1. Adding WordPress meta box function to create a input meta box for all post in a WordPress theme to get a hyperlink value and save it
  2. Using the meta box value in all posts to display hyperlink saved by meta box.

What will We Use

WordPress, CSS, HTML, PHP

How to Implement in WordPress

Adding meta boxes can be divided into three parts

  1. Adding Meta box to Post types
  2. Function to display forms fields on the posts
  3. Saving Meta box value
  4. Using saved meta box values

1. Adding Meta Box to Post Types

Following function will be added to function.php file of your WordPress which will add a meta box to all post types in your WordPress.

2. Function to display forms fields on the posts

This function will add form field to post edit screen where you will add the value to the meta box. This function should be added to function.php file.

3. Saving Meta box value

Following function will do several things. It is responsible to check multiple validations before saving the values. These checks ensures that value saved correctly. after checking necessary conditions this function will save the values to WordPress database. This function also should be added to function.php file.

4. Using saved meta box values

This is the last piece of code of our sample. Here we will retrieve the saved meta box value and use it. We can use this value for any purpose needed for our project. In this example you can write below code to your custom page template or post template single.php to display saved meta box value to show saved Download Link.


I believe what you wrote made a bunch of sense. However, think about this, suppose you wrote a catchier post title? I am not suggesting your information is not solid., but suppose you added something that makes people want more? I mean Home – ULook Webdesign is kinda vanilla. You ought to look at Yahoo’s home page and watch how they create article headlines to get people
to open the links. You might add a video or a related pic or two to get people excited about everything’ve written. In my opinion, it would bring your posts a little livelier.


Leave a Reply

Your email address will not be published. Required fields are marked *