Add a project meta field

This tutorial will guide you through the process of adding a custom meta field to the Project Details meta box and display the content of it on the frontend via the filters within Projects. As an example we’ll be adding a ‘location’ field.

All the snippets in this tutorial should be added to the functions.php file of your child theme. Alternatively you could create a custom plugin and add the code there so that the customization is portable between themes.

Note: This is a Developer level doc. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our  Support Policy.

Adding the field to the meta box ↑ Back to top

This adds the location field:

Screen Shot 2014-02-18 at 10.51.24

All data saving is handled by the plugin. That’s it! You added a new meta field.

Displaying the custom field data on the frontend ↑ Back to top

Now let’s display the contents of that new meta field in the projects archive.

This snippet displays the location after the short description on project archives.

Screen Shot 2014-02-18 at 11.02.07

The important part of this snippet is the code inside the function. You can use this to output the custom field data in any template file. For example you could add this to single-project/meta.php to display the data on the single page. You can read about safely editing Projects templates here.

Supported input types ↑ Back to top

As of Projects 1.2.0 you can add a variety of input boxes making the possibilities for output on the frontend endless!

  • hidden
  • text
  • textarea
  • url
  • upload
  • radio
  • checkbox
  • multicheck
  • select
  • Custom (use the projects_data_field_type_ filter)

You can use the following snippet to add these input types:

WooCommerce - the most customizable eCommerce platform for building your online business.

Back to the top