• HI, i hv followed this guide http://codex.wordpress.org/Function_Reference/register_post_type
    to register new post type (wp 2.9.2)

    Here is my code placed in functions.php at current theme dir

    ################## REGISTER POST TYPE IKLAN ########################
    
    add_action('init', 'register_iklan_init');
    function register_iklan_init()
    {
      $labels = array(
        'name' => _x('Iklan', 'post type general name'),
        'singular_name' => _x('Iklan', 'post type singular name'),
        'add_new' => _x('Add New', 'iklan'),
        'add_new_item' => __('Add New Iklan'),
        'edit_item' => __('Edit Iklan'),
        'new_item' => __('New Iklan'),
        'view_item' => __('View Iklan'),
        'search_items' => __('Search Iklan'),
        'not_found' =>  __('No iklan found'),
        'not_found_in_trash' => __('No iklan found in Trash'),
        'parent_item_colon' => ''
      );
      $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
    	'exclude_from_search' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => '5',
        'supports' => array('title','editor','author','thumbnail','excerpt','comments','custom-fields'),
    	'taxonomies' => array('blokiklan')
      );
      register_post_type('iklan',$args);
    }
    
    //add filter to insure the text Book, or book, is displayed when user updates a book
    add_filter('post_updated_messages', 'iklan_updated_messages');
    function book_updated_messages( $messages ) {
    
      $messages['iklan'] = array(
        0 => '', // Unused. Messages start at index 1.
        1 => sprintf( __('Iklan updated. <a href="%s">View iklan</a>'), esc_url( get_permalink($post_ID) ) ),
        2 => __('Custom field updated.'),
        3 => __('Custom field deleted.'),
        4 => __('Iklan updated.'),
        /* translators: %s: date and time of the revision */
        5 => isset($_GET['revision']) ? sprintf( __('Iklan restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
        6 => sprintf( __('Iklan published. <a href="%s">View iklan</a>'), esc_url( get_permalink($post_ID) ) ),
        7 => __('Iklan saved.'),
        8 => sprintf( __('Iklan submitted. <a target="_blank" href="%s">Preview iklan</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
        9 => sprintf( __('Iklan scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview iklan</a>'),
          // translators: Publish box date format, see http://php.net/date
          date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
        10 => sprintf( __('Iklan draft updated. <a target="_blank" href="%s">Preview iklan</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
      );
    
      return $messages;
    }
    
    //CUSTOM TAXONOMY FOR IKLAN ONLY
    add_action( 'init', 'create_iklan_taxonomy', 0 );
    
    function create_iklan_taxonomy() {
    register_taxonomy( 'blokiklan', 'iklan', array('hierarchical' => false, 'label' => 'Blok Iklan', 'query_var' => true, 'rewrite' => true ) );
    }
    
    //END REGISTER POST TYPE IKLAN

    unfortunatelly it wont show admin ui
    i have set ‘show_ui’ => true, at the args above…

    I don’t know what’s wrong with the code,
    anyone could help me?

    thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘register_post_type does not show admin ui’ is closed to new replies.