Skip to content

Instantly share code, notes, and snippets.

@slowmove
Created February 5, 2014 16:49

Revisions

  1. Erik Johansson created this gist Feb 5, 2014.
    35 changes: 35 additions & 0 deletions register post type
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    <?php
    function register_person_type() {
    $labels = array(
    'name' => 'Personer',
    'singular_name' => 'Person',
    'add_new' => 'Lägg till Person',
    'add_new_item' => 'Lägg till Person',
    'edit_item' => 'Redigera Person',
    'new_item' => 'Ny Person',
    'all_items' => 'Alla Personer',
    'view_item' => 'Visa Person',
    'search_items' => 'Sök Personer',
    'not_found' => 'Inga Personer funna',
    'not_found_in_trash' => 'Inga Personer funna i papperskorgen',
    'parent_item_colon' => '',
    'menu_name' => 'Personer / Anställda'
    );

    $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'person' ),
    'capability_type' => 'post',
    'has_archive' => true,
    'hierarchical' => false,
    'menu_position' => null
    );

    register_post_type( 'personer', $args );
    }
    add_action( 'init', 'register_person_type' );