WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post type setup problem (1 post)

  1. WPWebs
    Member
    Posted 3 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic