WordPress.org

Support

Support » How-To and Troubleshooting » Custom Post type setup problem

Custom Post type setup problem

  • WPWebs

    @vipuljariwala-1

    Hi there,

    This is vipul jariwala and I have a site http://wpwebs.com.

    I want to add custom post type to my site. I got related help from the link: http://codex.wordpress.org/Function_Reference/register_post_type

    I use the same example given there:
    add_action(‘init’, ‘my_custom_init’);
    function my_custom_init()
    {
    $labels = array(
    ‘name’ => _x(‘Books’, ‘post type general name’),
    ‘singular_name’ => _x(‘Book’, ‘post type singular name’),
    ‘add_new’ => _x(‘Add New’, ‘book’),
    ‘add_new_item’ => __(‘Add New Book’),
    ‘edit_item’ => __(‘Edit Book’),
    ‘new_item’ => __(‘New Book’),
    ‘view_item’ => __(‘View Book’),
    ‘search_items’ => __(‘Search Books’),
    ‘not_found’ => __(‘No books found’),
    ‘not_found_in_trash’ => __(‘No books found in Trash’),
    ‘parent_item_colon’ => ”
    );
    $args = array(
    ‘labels’ => $labels,
    ‘public’ => true,
    ‘publicly_queryable’ => true,
    ‘show_ui’ => true,
    ‘query_var’ => true,
    ‘rewrite’ => true,
    ‘capability_type’ => ‘post’,
    ‘hierarchical’ => false,
    ‘menu_position’ => null,
    ‘supports’ => array(‘title’,’editor’,’author’,’thumbnail’,’excerpt’,’comments’)
    );
    register_post_type(‘book’,$args);
    }

    ——————-
    I have set my blog permalink like “/%postname%/“.
    ——————-
    It’s ok while I set ‘rewrite’ => true, to false but it create problem while I set it to true.

    Please help what wrong with me?

    Thanks

  • The topic ‘Custom Post type setup problem’ is closed to new replies.
Skip to toolbar