96 lines
4.5 KiB
PHP
96 lines
4.5 KiB
PHP
<?php
|
|
if ( ! defined( 'ABSPATH' ) ) exit;
|
|
|
|
class WMW_Post_Types {
|
|
|
|
public function register() {
|
|
add_action( 'init', array( $this, 'register_post_types' ) );
|
|
add_action( 'init', array( $this, 'register_taxonomies' ) );
|
|
}
|
|
|
|
public function register_post_types() {
|
|
|
|
// ── Wiki (Container) ───────────────────────────────────────────────
|
|
register_post_type( 'wmw_wiki', array(
|
|
'labels' => array(
|
|
'name' => 'Wikis',
|
|
'singular_name' => 'Wiki',
|
|
'add_new' => 'Neues Wiki',
|
|
'add_new_item' => 'Neues Wiki erstellen',
|
|
'edit_item' => 'Wiki bearbeiten',
|
|
'view_item' => 'Wiki ansehen',
|
|
'search_items' => 'Wikis durchsuchen',
|
|
'not_found' => 'Keine Wikis gefunden',
|
|
'menu_name' => 'WP Multi Wiki',
|
|
'all_items' => 'Alle Wikis',
|
|
),
|
|
'public' => true,
|
|
'has_archive' => true,
|
|
'show_in_menu' => false,
|
|
'show_in_rest' => true,
|
|
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ),
|
|
'rewrite' => array( 'slug' => 'wiki', 'with_front' => false ),
|
|
'menu_icon' => 'dashicons-book-alt',
|
|
'capability_type' => 'post',
|
|
) );
|
|
|
|
// ── Wiki Article ───────────────────────────────────────────────────
|
|
register_post_type( 'wmw_article', array(
|
|
'labels' => array(
|
|
'name' => 'Wiki-Artikel',
|
|
'singular_name' => 'Wiki-Artikel',
|
|
'add_new' => 'Neuer Artikel',
|
|
'add_new_item' => 'Neuen Artikel erstellen',
|
|
'edit_item' => 'Artikel bearbeiten',
|
|
'view_item' => 'Artikel ansehen',
|
|
'search_items' => 'Artikel durchsuchen',
|
|
'not_found' => 'Keine Artikel gefunden',
|
|
'all_items' => 'Alle Artikel',
|
|
),
|
|
'public' => true,
|
|
'has_archive' => false,
|
|
'show_in_menu' => false,
|
|
'show_in_rest' => true,
|
|
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields', 'revisions' ),
|
|
'rewrite' => array( 'slug' => 'wiki-artikel', 'with_front' => false ),
|
|
'menu_icon' => 'dashicons-media-document',
|
|
'capability_type' => 'post',
|
|
) );
|
|
}
|
|
|
|
public function register_taxonomies() {
|
|
|
|
// ── Wiki Category ──────────────────────────────────────────────────
|
|
register_taxonomy( 'wmw_category', 'wmw_article', array(
|
|
'labels' => array(
|
|
'name' => 'Wiki-Kategorien',
|
|
'singular_name' => 'Kategorie',
|
|
'add_new_item' => 'Neue Kategorie',
|
|
'edit_item' => 'Kategorie bearbeiten',
|
|
'all_items' => 'Alle Kategorien',
|
|
),
|
|
'public' => true,
|
|
'hierarchical' => true,
|
|
'show_in_rest' => true,
|
|
'show_admin_column' => true,
|
|
'rewrite' => array( 'slug' => 'wiki-kategorie' ),
|
|
) );
|
|
|
|
// ── Wiki Tag ───────────────────────────────────────────────────────
|
|
register_taxonomy( 'wmw_tag', 'wmw_article', array(
|
|
'labels' => array(
|
|
'name' => 'Wiki-Tags',
|
|
'singular_name' => 'Tag',
|
|
'add_new_item' => 'Neues Tag',
|
|
'edit_item' => 'Tag bearbeiten',
|
|
'all_items' => 'Alle Tags',
|
|
),
|
|
'public' => true,
|
|
'hierarchical' => false,
|
|
'show_in_rest' => true,
|
|
'show_admin_column' => true,
|
|
'rewrite' => array( 'slug' => 'wiki-tag' ),
|
|
) );
|
|
}
|
|
}
|