Skip to content

Instantly share code, notes, and snippets.

@willtm
Forked from dshanske/kind-register.php
Last active April 19, 2022 15:40
Show Gist options
  • Save willtm/af4dd01790f1090dc3f1b2e36eabaf0d to your computer and use it in GitHub Desktop.
Save willtm/af4dd01790f1090dc3f1b2e36eabaf0d to your computer and use it in GitHub Desktop.
Example Plugin for Registering Kinds(untested)
<?php
/**
* Plugin Name: Register Annotation Post Kind - Name
* Plugin URI: https://example.com
* Description: Register Annotation Post Kind
* Version: None
* Author:
* Author URI:
* Text Domain:
* Domain Path:
*/
function annotation_register_kind() {
register_post_kind(
'annotation',
array(
'singular_name' => __( 'Annotation', 'indieweb-post-kinds' ), // Name for one instance of the kind
'name' => __( 'Annotations', 'indieweb-post-kinds' ), // General name for the kind plural
'verb' => __( 'Annotated', 'indieweb-post-kinds' ), // The string for the verb or action (liked this)
'property' => 'annotation-of', // microformats 2 property
'format' => 'bookmark', // Post Format that maps to this
'description' => __( 'Purchases, gifts, found things, or objects donated to me', 'indieweb-post-kinds' ),
'description-url' => 'http://indieweb.org/annotation',
'title' => true, // Should this kind have an explicit title
'show' => true, // Show in Settings
)
);
set_post_kind_visibility( 'follow' ); // Example of how to enable a hidden kind.
}
add_action( 'init', 'annotation_register_kind' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment