Maintaining Online Collections p.1

This is a multi-part series on maintaining online collections using WordPress. There are several options out there for art database management, but as we’ll discuss later, WordPress is the best choice as it allows you to have your museum or institution website and collection database in the same location.

By the end of this lesson, we’ll have set up a plugin that creates a Custom Post Type for your collection of art, artifacts, sculpture or whatever you plan on displaying. If that made no sense to you, don’t worry- I’ll walk you through everything you need to get your collection online. 

Is this the best choice for your art collection database?

First of all, why do you need to use WordPress? Well, this type of data or collection management is what WordPress excels at. It allows you to easily upload and display information for large numbers of objects while creating an attractive site. There are other options, but this tutorial will deal with WordPress exclusively.

So why would you want to set this up if you can just uses default pages or posts? Well, there are several reasons. You might want to create a search that applies to only these items rather than everything on the site. You also might want to create an online exhibition that can be easily managed with a few button clicks. These are just a few examples, but trust me, not matter how large your collection is, this is the way to go.

We’ll create a plugin for it rather than putting it in the theme so you can change your theme without losing the functionality of the custom post type. 

So what is a Custom Post Type? It’s very similar to a post or a page, but allows you to customize the content that is displayed but creating templates for the post type as well as more effective archiving and searching. In this case, it allows us to have and Objects group that lives separately from other content on the site.

First things first: you need to find a way to edit your code. If you don’t want to download any new programs, you can just use Notepad or any other basic text editor that came with your operating system. Another option is Atom, it’s free and easy to use.

For this tutorial, we’re going to name our plugin Custom Collection Plugin. Create a folder on your desktop and name it custom-collection-plugin.

Now go to your text editor and create a new file, name it custom-collection-plugin.php and add it to your folder. Now go here and copy the code and paste it into the file. There are three parts to this file. 

I won’t go a full description here, but it’s good to have an idea of what code does before adding it to your site. The header area names the plugin and defines the rules related to use.

 * Plugin Name:       Custom Collection Plugin
 * Plugin URI:
 * Description:       Creates a collection custom post type called Objects.
 * Version:           1.0
 * Requires at least: 5.2
 * Requires PHP:      7.2
 * License:           GPL v2 or later
 * License URI:
 * Text Domain:       custom-collection-plugin

The second section creates the custom post type called Objects.

					// Register Custom Post Type
function object_custom_post_type() {

	$labels = array(
		'name'                  => _x( 'Objects', 'Post Type General Name', 'text_domain' ),
		'singular_name'         => _x( 'Object', 'Post Type Singular Name', 'text_domain' ),
		'menu_name'             => __( 'Objects', 'text_domain' ),
		'name_admin_bar'        => __( 'Object', 'text_domain' ),
		'archives'              => __( 'Object Archives', 'text_domain' ),
		'attributes'            => __( 'Object Attributes', 'text_domain' ),
		'parent_item_colon'     => __( 'Parent Object:', 'text_domain' ),
		'all_items'             => __( 'All Objects', 'text_domain' ),
		'add_new_item'          => __( 'Add New Object', 'text_domain' ),
		'add_new'               => __( 'Add New', 'text_domain' ),
		'new_item'              => __( 'New Object', 'text_domain' ),
		'edit_item'             => __( 'Edit Object', 'text_domain' ),
		'update_item'           => __( 'Update Object', 'text_domain' ),
		'view_item'             => __( 'View Object', 'text_domain' ),
		'view_items'            => __( 'View Objects', 'text_domain' ),
		'search_items'          => __( 'Search Object', 'text_domain' ),
		'not_found'             => __( 'Not found', 'text_domain' ),
		'not_found_in_trash'    => __( 'Not found in Trash', 'text_domain' ),
		'featured_image'        => __( 'Featured Image', 'text_domain' ),
		'set_featured_image'    => __( 'Set featured image', 'text_domain' ),
		'remove_featured_image' => __( 'Remove featured image', 'text_domain' ),
		'use_featured_image'    => __( 'Use as featured image', 'text_domain' ),
		'insert_into_item'      => __( 'Insert into Object', 'text_domain' ),
		'uploaded_to_this_item' => __( 'Uploaded to this Object', 'text_domain' ),
		'items_list'            => __( 'Objects list', 'text_domain' ),
		'items_list_navigation' => __( 'Objects list navigation', 'text_domain' ),
		'filter_items_list'     => __( 'Filter Objects list', 'text_domain' ),
	$args = array(
		'label'                 => __( 'Object', 'text_domain' ),
		'description'           => __( 'Object Description', 'text_domain' ),
		'labels'                => $labels,
		'supports'              => array( 'title', 'editor', 'thumbnail', 'comments', 'custom-fields' ),
		'taxonomies'            => array( 'object_cats' ),
		'hierarchical'          => true,
		'public'                => true,
		'show_ui'               => true,
		'show_in_menu'          => true,
		'menu_position'         => 5,
		'menu_icon'           => 'dashicons-portfolio',
		'show_in_admin_bar'     => true,
		'show_in_nav_menus'     => true,
		'can_export'            => true,
		'has_archive'           => true,
		'exclude_from_search'   => false,
		'publicly_queryable'    => true,
		'query_var'             => 'object',
		'capability_type'       => 'page',
	register_post_type( 'object', $args );

add_action( 'init', 'object_custom_post_type', 0 );

The third section allows you to create categories or taxonomies for the post type. This can come in handy if you’re building an exhibition.

					// Register Custom Taxonomy
function object_custom_taxonomy() {

	$labels = array(
		'name'                       => _x( 'Taxonomies', 'Taxonomy General Name', 'text_domain' ),
		'singular_name'              => _x( 'Taxonomy', 'Taxonomy Singular Name', 'text_domain' ),
		'menu_name'                  => __( 'Taxonomy', 'text_domain' ),
		'all_items'                  => __( 'All Items', 'text_domain' ),
		'parent_item'                => __( 'Parent Item', 'text_domain' ),
		'parent_item_colon'          => __( 'Parent Item:', 'text_domain' ),
		'new_item_name'              => __( 'New Item Name', 'text_domain' ),
		'add_new_item'               => __( 'Add New Item', 'text_domain' ),
		'edit_item'                  => __( 'Edit Item', 'text_domain' ),
		'update_item'                => __( 'Update Item', 'text_domain' ),
		'view_item'                  => __( 'View Item', 'text_domain' ),
		'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),
		'add_or_remove_items'        => __( 'Add or remove items', 'text_domain' ),
		'choose_from_most_used'      => __( 'Choose from the most used', 'text_domain' ),
		'popular_items'              => __( 'Popular Items', 'text_domain' ),
		'search_items'               => __( 'Search Items', 'text_domain' ),
		'not_found'                  => __( 'Not Found', 'text_domain' ),
		'no_terms'                   => __( 'No items', 'text_domain' ),
		'items_list'                 => __( 'Items list', 'text_domain' ),
		'items_list_navigation'      => __( 'Items list navigation', 'text_domain' ),
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => false,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
	register_taxonomy( 'taxonomy', array( 'object' ), $args );

add_action( 'init', 'object_custom_taxonomy', 0 );

You can find the full code here.

Now that you have your file in your folder, you’ll need to zip the folder. After zipping, you can go to Plugins > Add New in your WordPress Dashboard and upload and activate the plugin. Once you’ve done that, you’ll be able to see your new custom post type in your dashboard.


Now that you have the custom post type set up, the next tutorial will show you how to use it. 

If you liked it, share it


What do you think?