Skip to content

Instantly share code, notes, and snippets.

@tjkhara
Created November 24, 2021 16:06
Show Gist options
  • Save tjkhara/cc2c8cdff8c2df72710857d4ab6f99c5 to your computer and use it in GitHub Desktop.
Save tjkhara/cc2c8cdff8c2df72710857d4ab6f99c5 to your computer and use it in GitHub Desktop.
mu-plugins code
<?php
function site_post_types() {
// Project
register_post_type('project', array(
'show_in_rest' => true,
'supports' => array('title', 'editor', 'excerpt'),
'rewrite' => array('slug' => 'projects'),
'has_archive' => true,
'public' => true,
'labels' => array(
'name' => 'Projects',
'add_new_item' => 'Add New Project',
'edit_item' => 'Edit Project',
'all_items' => 'All Projects',
'singular_name' => 'Project'
),
'menu_icon' => 'dashicons-admin-tools'
));
// Skill
register_post_type('skill', array(
'show_in_rest' => true,
'supports' => array('title'),
'rewrite' => array('slug' => 'skills'),
'has_archive' => true,
'public' => true,
'labels' => array(
'name' => 'Skills',
'add_new_item' => 'Add New Skill',
'edit_item' => 'Edit Skill',
'all_items' => 'All Skills',
'singular_name' => 'Skill'
),
'menu_icon' => 'dashicons-media-code'
));
// Clients
register_post_type('client', array(
'show_in_rest' => true,
'supports' => array('title', 'editor', 'thumbnail'),
'rewrite' => array('slug' => 'clients'),
'has_archive' => true,
'public' => true,
'labels' => array(
'name' => 'Clients',
'add_new_item' => 'Add New Client',
'edit_item' => 'Edit Client',
'all_items' => 'All Clients',
'singular_name' => 'Client'
),
'menu_icon' => 'dashicons-businesswoman'
));
}
add_action('init', 'site_post_types');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment